java - How can I distinguish between "run all tests" and "run just this test"? -


i have tests run very slow, test exports large database test exporting code memory leaks. i'd have these tests in usual test suite should ignored unless 1 of these conditions fulfilled:

  1. the test running on ci server
  2. the user has selected test in ide , runs it

the solution #1 simple: use property , skip test if it's not set.

but how implement #2?

[edit] java specific. i'm using junit 4 eclipse.

i have tests run slow, test exports large database test exporting code memory leaks.

while useful, these not unit tests, denoted unit-test tag.

a test not unit test if:

  • it talks database
  • it communicates across network
  • it touches file system
  • it can't run @ same time of other unit tests
  • you have special things environment (such editing config files) run it.

tests these things aren't bad , worth writing. can written in using unit test framework. however, important able separate them true unit tests can keep set of tests can run fast whenever make changes, particularly in tdd cycle want go failing test passing test possible.

if using makefile have check target true unit-tests , livecheck target these slow, system tests.

how run each test individually depend on framework.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -