Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use @Ignore in AndroidTestCase

Tags:

I'm working my way through some unit testing with AndroidTestCase and was wondering, if it's possible to use the ignore-annotation, that I've read about for junit4? Just using the annotation gives an error, maybe, there's something special to look out for?

Thanx in advance, Marcus

like image 433
Marcus Toepper Avatar asked Jul 22 '12 12:07

Marcus Toepper


People also ask

What is the use of @ignore annotation?

The @Ignore annotation helps in this scenario. A test method annotated with @Ignore will not be executed. If a test class is annotated with @Ignore, then none of its test methods will be executed.

How do I ignore test cases on Android?

You can use @Suppress on the test case class or individual test methods to suppress test execution.

How can we ignore a particular Testcase?

If you want to ignore a test method, use @Ignore along with @Test annotation. If you want to ignore all the tests of class, use @Ignore annotation at the class level.


2 Answers

You can use @Suppress on the test case class or individual test methods to suppress test execution.

like image 100
Jens Avatar answered Oct 25 '22 13:10

Jens


You can now use either @Suppress or @Ignore when running with AndroidJUnit4.

like image 41
Kevin Brotcke Avatar answered Oct 25 '22 15:10

Kevin Brotcke