Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running an @Ignored JUnit test in Eclipse

Tags:

junit

eclipse

In my Eclipse project (Eclipse Luna) I have a few JUnit test cases that I don't want to run in the full regression test. For instance because they require a user to be present to verify the result (such as , if a sound properly played), or because they only run properly on specific systems. These tests are mostly used manually when making changes to the class under test. I have used @Ignore to ignore those tests.

When I run a class with ignored tests in it from Eclipse (Run As -> Junit test) it will show the ignored tests as ignored in the test list.

Is there a way to force run the ignored tests from Eclipse?

Currently I always remove the @Ignored tag, but it is easy to forget to ignore the tests again before committing my changes. Is there a better way to do this?

I expected Eclipse to have an option in the JUnit View of an ignore test also run Ignored tests , but I can't find it.

like image 772
Thirler Avatar asked Nov 30 '15 10:11

Thirler


1 Answers

You could use JUnit's Categories. Create a category for the tests that need manual interaction and exclude that category in your automated build.

like image 148
Stefan Birkner Avatar answered Nov 08 '22 06:11

Stefan Birkner