Search code examples
junitconditional-statementssuppress

Conditional skipping of unit tests


I'm currently working on a class, dealing with network issues. Using JUnit 3.8.1 and having a hardware device, that's not always around to test against, I'd like to conditionally suppress individual tests. Is there a way to achive this with a simple annotation like @if(!gatewayAvailable) -> test's suppressed?

Thanx for any pointers, marcus


Solution

  • There is no such feature in JUnit 3.8.1. You have to use JUnit4 and its Assume class.