Why is my junit test case treated like 3.x one when I extend from junit.framework.TestCase
I am trying to run my test case using junit 4.X runner, but it is 开发者_如何学运维treated like 3.x one when I extend from junit.framework.TestCase.
I had to this as the out current test framework base test class extends from junit.framework.TestCase.
So what is your question?
Why does it work that way? As having JUnit 3 style tests running in a JUnit 4 way could easily lead to confusion. Mixing and matching in the test class is a bad idea, personally I think that JUnit (or a 3rd party tool) should display a warning if you mix them in a class.
The end result is that you need to either write the test class as JUnit 4 or JUnit 3 style test class. If you are tied to JUnit 3 due to your own test classes then look at refactoring them. If you are tied to JUnit 3 due to 3rd party tools then look at upgrading that tool.
精彩评论