Java Reference
In-Depth Information
Figure D.8
Our test passes when we fix
the error and save the file.
JU nit MAX runs your tests during development time, thus saving you the time required
to explicitly run your tests through a separate interface—Ant, Maven, or some other
graphic runner.
D.2.2
Execution order
Another neat feature of this JU nit plug-in is the special order in which different tests
are executed.
Tests don't fail at random. Recently failed tests are more likely to fail again. When
you execute your tests with the JU nit MAX plug-in, it will take note of this and will run
your recently failed tests first. This way, you get valuable feedback on the status of your
tests very early in the running phase. The plug-in also executes your short tests before
longer ones, again giving you valuable information early.
D.2.3
Reverting to last stable version
One of the most annoying problems is someone committing code in the source repos-
itory that breaks existing functionality—obviously he forgot to run his set of tests. We
can detect possible problems early by using a continuous integration system like the
ones we explored in chapter 10. Obviously, we need some time to see why the things are
breaking down. But how do we know what the last stable version of a test was? How do
we easily revert to the last version of our test case in which all the tests passed?
One way is to check your version control logs. The JU nit MAX plug-in, however,
offers an easier solution to this problem. You right-click your test in the package
explorer of Eclipse and select the Revert To Last Green item. Nice, isn't it?
D.3
JUnit integration with NetBeans
This section serves as a reference guide to how to work with the NetBeans IDE and
how to write, execute, and compose JU nit tests from within NetBeans.
D.3.1
Installing NetBeans
NetBeans installation requires several steps. First, you need to go to the download sec-
tion of the NetBeans website ( http://www.netbeans.org/downloads/index.html ). You
need to select from the upper-right corner of the page the platform on which you'll
install the software as well as the type of installation you want. In this topic we use the
6.5 version of the NetBeans project installed on Windows.
 
 
 
Search WWH ::




Custom Search