Running JUnit through Eclipse
I run my JUnit tests through Eclipse (Helios, 1.3.0) through an ant build file and an external ant builder. I was wondering if it's possible to use Eclipes's JUnit UI when running them so that I can see the 'green' or 'red' bar in there instead of seeing success/failure messages in the con开发者_高级运维sole. Any pointers are greatly appreciated. Thanks!
If you must run your tests via ant, then there is no direct way to see the progress in the JUnit view. However, if you are using the JUnit ant task and set the output format of your test results to xml
:
Then, you can open this file up in the JUnit window. Click on the button on the far right and select Import
. Then navigate to the file you want to open:
If you have JUnit reference for a project, I think you can right click on a project and select Run As > JUnit Test
and that will run all the tests in the Project. Check out this post
Eclipse: Writing and running JUnit tests
精彩评论