Reputation: 51049
I have a couple of tests that can run only if one condition met (media server is up and operational). How should I code this condition so that jUnit don't run rests if server is down and inform me that the reason is not met?
UPDATE
May be I can describe some test dependency?
The goal is to see that not tests failed, but condition does not met. If I code setUp
or something I will just see that multiple tests are failed, without any explanation. If I had one test which tests condition itself and all other tests execute only if this one suceeded, then the problem would evident...
Upvotes: 0
Views: 76
Reputation: 83537
You could add this as part of your setUp()
code. If setUp()
throws an exception, the test isn't run. Of course, the TestRunner usually iterates through each method that starts with test
and runs setUp()
for each one, so this isn't a terribly efficient solution.
Upvotes: 1