jenkins the definitive guide

(Jeff_L) #1

This full view gives you both a good overview of the current state of your tests, and an indication of
their history. The Age column tells you how for how long a test has been broken, with a hyperlink that
takes you back to the first build in which this test failed.


You can also add a description to the test results, using the Edit Description link in the top right-hand
corner of the screen. This is a great way to annotate a build failure with some additional details, in order
to add extra information about the origin of test failures or some notes about how to fix them.


When a test fails, you generally want to know why. To see the details of a particular test failure, just click
on the corresponding link on this screen. This will display all the gruesome details, including the error
message and the stack trace, as well as a reminder of how long the test has been failing (see Figure 6.7,
“The details of a test failure”). You should be wary of tests that have been failing for more than just a
couple of builds—this is an indicator of either a tricky technical problem that might need investigating,
or a complacent attitude to failed builds (developers might just be ignoring build failures), which is more
serious and definitely should be investigated.


Figure 6.7. The details of a test failure


Make sure you also keep an eye on how long your tests take to run, and not just whether they pass or fail.
Unit tests should be designed to run fast, and overly long-running tests can be the sign of a performance
issue. Slow unit tests also delay feedback, and in CI, fast feedback is the name of the game. For example,
running one thousand unit tests in five minutes is good—taking an hour to run them is not. So it is a
good idea to regularly check how long your unit tests are taking to run, and if necessary investigate why
they are taking so long.


Luckily, Jenkins can easily tell you how long your tests have been taking to run over time. On the build
job home page, click on the “trend” link in the Build History box on the left of the screen. This will give
you a graph along the lines of the one in Figure 6.8, “Build time trends can give you a good indicator
of how fast your tests are running”, showing how long each of your builds took to run. Now tests are
not the only thing that happens in a build job, but if you have enough tests to worry about, they will

Free download pdf