Eclipse - default to JUnit 3
How can I tell my modern Eclipse (Galileo, Helios) that all unit tests in my workspace (or anywhere) are written in JUnit 3 and so I would like them to be run with this older JUnit version?
I am talking about project/workspace/system default. Not a single specific test suite. I need it to 开发者_开发问答use JUnit 3 by default for all these tiny 10-case suites I encounter.
Go to Run
icon on the toolbar, pick "Run Configurations", create a new JUnit configuration (or pick an existing one), then select JUnit 3.
If you have already tried to run a group of tests, this group should appear as an existing entry under the JUnit menu.
It's worth pointing out that most JUnit3 tests can be run by the JUnit 4 test runner. However, the JUnit4 runner can't handle some of the more esoteric features like certain test suite configurations.
You can run Junit 3 tests with the Junit 4 runner - see this SO question. I find this is the better solution as I'd recommend any new tests you write be with Junit 4 as the annoation-based testing is much nicer in my opinion.
精彩评论