In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
How to solve the problem of IDEA JUnit5 test suite running errors, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, hope you can gain something.
1. problem
In Idea 2017.3, create a test case Test Case for JUnit5 and a test suite for JUnit4, prompting an error "java.lang.Exception: No runnable methods" when running the test suite.
two。 Analysis.
When Java conducts unit testing, it usually creates multiple test cases Test Case, or multiple test classes (each test class includes multiple test cases). But if you need to run these test cases at the same time, you will generally use the test suite in JUnit4. By running the test suite, you will run multiple test case classes in the suite at a time.
Reference answer: you can use JUnit 4 to run the suite, but it does not apply to JUnit 5. 5.
If you are using IntelliJ IDEA 2016.2, test classes annotated with @ RunWith (JUnitPlatform.class) cannot be executed in IDE at this time.
The answer is long.
According to your reported behavior, after some painstaking investigation, I believe I have the answer to your question.
If you are using IntelliJ IDEA 2016.2 with built-in support for JUnit 5, here is what is happening.
IDEA starts the JUnit platform through Launcher API and chooses a test class annotated with @ RunWith (JUnitPlatform.class) (let's call it TestSuite). Launcher detects junit-jupiter and junit-vintage TestEngine implementations. JUnit Jupiter engine ignores TestSuite because it is not technically a JUnit Jupiter test class. JUnit Vintage engine also ignores TestSuite because it is annotated with @ RunWith (JUnitPlatform.class). The end result is that neither registered test engine claims that it can run the TestSuite class.
3. Solution
Later versions of IntelliJ IDEA 2016.2 directly support test suites. Instead of writing Java code, you just right-click the test class Java file in the project view of IDEA and select Run 'XXX (test file name)', which will run all the test cases in the test class, as shown below:
Or right click on the package name menu of the test class and select "Run Tests in XXX" to run all the test cases in the package.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.