Java – how to run a single JUnit test method in eclipse?
•
Java
There is already an answer to this question: > running a single JUnit test in eclipse 12
For example, how to run a test method from the following code?
@Test
public void testHelloEmpty()
{
assertEquals(h.getName(),"");
assertEquals(h.getMessage(),"Hello!");
}
@Test
public void testHelloWorld()
{
// h.setName("World");
assertEquals(h.getName(),"World");
assertEquals(h.getMessage(),"Hello World!");
}
I've tried to highlight a @ test method and try to run it, but it won't work like this
Solution
Run a single test case in eclipse (based on your recent comments):
>Go to run (green forward arrow button) – > run configuration > right click JUnit and select new. > Fill in your test cases and test methods (the search button is very useful here). > Click Run
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
