Why is org. JUnit 4 required for testing ???

Source: Internet
Author: User

Recently, I was running a test case. When running the test case, I found that some methods can run normally, but some methods reported Org. junit.4 (the pop-up information indicates that running this method requires the support of junit4). But why does junit3 in eclipse report the information of junit4? As a result, I started to recall the latest operations. In eclipse, I started to reference junit4 to create a test case, but later I found it in junit4. Every time I run all the methods in the test case, you cannot run one of the methods, so you want to change to junit3. In junit3, you can run a method in the test case each time. If we create a test case under junit3, the running method is normal; if you run a previous test case, the previous error is reported. Therefore, it is suspected that the error is caused by changing the JUnit version.

Solution: for previously created test cases (fortunately not many, what should I do if there are many ?), Create a corresponding test case, copy the methods in the previous test case to the new test case, and then delete the previously created test case, finally, name the current test case as the previous test case name. Run the following command to check whether everything works normally and you can run a method.

BTW: Must all test cases created in junit4 be executed at a time? I am still using the problem. In short, when I want to run a method, all the methods in the test case are executed once, which is too annoying. Use junit3 first, after all, this is correct. Haha!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.