If you using JUnit 4.x, you can follow this way
| 1 | @Ignore//addthisannotationtoignorefollowingmethod |
| 2 | @Test |
| 3 | publicvoidmethodUnderTest() |
Change name of testmethod or remove annotation
Be aware that failing tests are indicators for you, that something goes wrong that you have to fix. So its a bad idea to remove or deactivate testcases or methods. Instead fix the problem or change the requirements your testcase holds.
For your convenience:
If you use junit 3.x simply rename the testmethod or prefix it with "failing", for example
| 1 | publicvoidfailingtestCalculateResult(){...} |
So you can simply search after "failingtest" over your complete project to find all this deactivated testmethods.
If you use junit 4.x simply remove the @Test anotation at the testmethod.
If you want to skip a whole testcase simple rename it in the same way. For example.
MyRepositoryTest to MyRepositoryFailing.
本文介绍了如何在JUnit4.x中忽略特定的测试方法或整个测试用例。通过使用@Ignore注解可以方便地跳过有问题的测试,同时提供了在JUnit3.x中类似的处理方式。文章强调了应该尽量修复测试而不是简单地忽略它们。
473

被折叠的 条评论
为什么被折叠?



