Java Reference
In-Depth Information
For full details on how to run Ant scripts from Eclipse, please see the integrated
Eclipse Help; click Help > Help Contents. Then, in the Help browser, select the fol-
lowing topic: Workbench User Guide > Getting Started > Ant & External Tools Tuto-
rial > Eclipse Ant Basics.
D.2
Introducing the JUnitMAX Eclipse plug-in
Kent Beck, one of the creators of JU nit, started another Eclipse plug-in called JU nit MAX
( http://www.threeriversinstitute.org/junitmax/subscribe-w-infinitest.html) . JU nit MAX
requires a $2 monthly subscription, but it offers quite a few features that you might
find interesting.
Let's take another look at the very first test case that we introduced in this topic
(listing D.1).
Listing D.1
The CalculatorTest case
public class CalculatorTest {
@Test
public void add() {
Calculator calculator = new Calculator();
double result = calculator.add( 10, 50 );
assertEquals( 60, result, 0 );
}
}
D.2.1
Integrated in your development cycle
One of the main features of JU nit MAX is that it's tightly integrated in your develop-
ment cycle. For instance, let's get an Eclipse with JU nit MAX installed and type in the
code from listing D.1. Now let's deliberately introduce an error inside the test. After
you press Ctrl+S to save your file, Eclipse will compile it, and JU nit MAX will run the
test for you, showing you the error we just introduced (figure D.7).
The test errors and failures are shown as compilation problems. You can also see
them on a project level in the package explorer; this way the risk of missing them and
committing broken tests is almost zero.
Now it's time to fix the error and save the document. The result is shown in fig-
ure D.8.
You see that the plug-in ran our test again and flagged it with a blue icon to denote
that it passed.
Figure D.7 Introducing an error in our test case causes JUnitMAX to execute the tests and report the
error as a red marker at the beginning of the line.
 
 
Search WWH ::




Custom Search