Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore a test within the JUnit test method itself

We have a number of integration tests that fail when our staging server goes down for weekly maintenance. When the staging server is down we send a specific response that I could detect in my integration tests. When I get this response instead of failing the tests I'm wondering if it is possible to skip/ignore that test even though it has started running. This would keep our test reports a bit cleaner.

Does anybody have suggestions?

like image 923
benstpierre Avatar asked Dec 22 '22 03:12

benstpierre


1 Answers

It's been awhile since I used JUnit but isn't there a way to Assume a condition is true? I think that has a different meaning than a pass/fail of the test. Your report should indicate that the test was not run.

Edited to add: Assume class

like image 73
Mike Daniels Avatar answered Feb 23 '23 20:02

Mike Daniels