Testing with JUnit in Eclipse
The basic idea of testing is probably as old as programming itself. These days, writing your own test objects is practically a must.
Tests help us catch most bugs and incorrect behavior, lowering the cost of fixing them. The old rule holds that we write tests once and keep them forever. We can change the internal logic of the objects under test as much as we like while leaving the tests alone. Over time, the tests build on each other, giving us a powerful way to test the application as a whole. No wonder testing is a basic idea in Extreme Programming.
If you’re looking for a convenient testing tool, I recommend JUnit, an open-source project built on Java. I recommend it from experience. Paired with the Eclipse development environment, it’s a powerful helper. It also supports a whole family of other IDEs. You can run tests from the console or see the output in JUnit’s own graphical interface, and you can run individual tests or the entire suite. If you’re interested in the plug-in and using it in Eclipse, here’s a good tutorial.
Related articles
Related CZ Podcast episodes
- #261 · Leadership
On leading people and teams. · Czech audio
- #3 · Java 6 SE, Vývoj webových aplikací
Dagi and Filemon discuss Java 6 and web application frameworks. · Czech audio
- #1 · Vývojová prostředí v Javě
The first CZ Podcast episode looks at Java development environments. · Czech audio