more moreUnit with TestNG
moreUnit is a copasetic Eclipse plug-in that provides two interesting features:
- It marks up classes, which have a corresponding developer test
- It generates a test case stub for desired methods
The tool is heavily focused on JUnit style testing; however, moreUnit works for TestNG as well. As I’ve already advocated, TestNG and JUnit play nicely together, so it shouldn’t be a surprise to see moreUnit complement TestNG.
moreUnit discovers corresponding tests via naming patterns; hence, if you have a hip class named Hierarchy, it’ll scan a project for a HierarchyTest or a TestHierarchy class. Because it’s my bag, I have quite a few code bases that have both TestNG and JUnit tests, I tend to specify TestNG tests via the TestNG suffix and leave JUnit tests with the traditional Test suffix.
Accordingly, I just had to add the new suffix to the moreUnit preference dialog shown below.
If you already have a TestNG test defined for a class (and moreUnit has spotted it), you can right click on non-tested methods and test cases will be generated. Just make sure you’ve unclicked “Create JUnit4 methods” option– otherwise you’ll have to fix an errant JUnit import. With the option unclicked, you’ll be left with a tripping old style JUnit test case (returning void and starting with test).
As you can see in the above figure, you can either right click over an untested method or type Ctrl+U to generate a test case stub.
All that’s left after the stub is created is an annotation (1.5 or 1.4 JavaDoc) and of course, the test logic. Dig it?
| Related odds and ends | ||
|---|---|---|
2 comments Thursday 26 Oct 2006 | Developer Testing, JUnit, TestNG
2 Responses to “more moreUnit with TestNG”
[...] more moreUnit with TestNG [...]
Buy phentermine online wi….
Buy phentermine online. Buy phentermine online with paypal. Buy phentermine online no prescription. Buy phentermine online buy cheap phentermine index. Buy phentermine online extra cheap phentermine….