Eclipse supports JUnit out of the box, and even has a handy keyboard shortcut for running all the test methods within a JUnit test class:
But what if you want to run just one of the many test methods with a particular test class? IntelliJ's IDEA has this option (you just right-click on the method name and run it) but Eclipse doesn't offer that feature.
One solution is to run all the tests within the test class (as described above) and then click on the particular test in the left-hand JUnit results window, right-click on the test and choose 'Run':
The other is to open the "Outline" view, and then right-click on appropriate unit test method, choose 'Run As' then 'JUnit Test':
That means that you don't have to run all the tests within a test class just to be able to run one of them. Now isn't that easier?
Technorati Tags: Java, Unit Testing, JUnit, Eclipse, Andrew Beacock
CTRL-F11
. You can also right-click within the unit test class, choose 'Run As' then 'JUnit Test'.But what if you want to run just one of the many test methods with a particular test class? IntelliJ's IDEA has this option (you just right-click on the method name and run it) but Eclipse doesn't offer that feature.
One solution is to run all the tests within the test class (as described above) and then click on the particular test in the left-hand JUnit results window, right-click on the test and choose 'Run':
The other is to open the "Outline" view, and then right-click on appropriate unit test method, choose 'Run As' then 'JUnit Test':
That means that you don't have to run all the tests within a test class just to be able to run one of them. Now isn't that easier?
Technorati Tags: Java, Unit Testing, JUnit, Eclipse, Andrew Beacock
Comments