Fixing the postbuild order problem of the upstream/downstream solution i wrote

Some days ago i wrote a post about how to get the overall status in the upstream job from the downstream jobs in Hudson or Jenkins (

A user (v22 ) test my code and had some problems, and actually, there is a problem.

As i said in the comment reply, there is a problem in the execution order of the post build actions, this is not deterministic and depends on how the job configuration is stored in a XML file located in the master node.

The relationship between the upstream jobs and the downstream jobs is ready when the fingerprints are recorded. This action is done on a post build action, like the Groovy execution. If the Groovy execution is performed before the fingerprint recording, there is not upstrem job set yet, therefore the Groovy code fails.

I proposed in that reply a workaround to change the order execution of the post build actions, but this is not working as i expected, so there is not a way to force the Groovy execution after the fingerprint recording.

There is an open ticket in the Jenkins and Hudson issue tracker to add a way to specify the post build actions executions:

But everything has a solution, and a solution that always works 😉

Continue reading

Detecting slow tests with PHPUnit

Edit: As Sebastian Bergmann told me via Twitter, PHPUnit already generate timing information into the JUnit XML logs, but the idea of this post is the earlier detection of slowness in tests, i mean, you are developing tests and you are executing them, thus you will detect quickly if the tests are exceeding a time limit.

The tests, in most of the cases, are written by developers. Sometimes, they don’t take care of the speed of those tests.

We, as test engineers, should detect, or even prevent, the slowness in tests.

PHPUnit let you use listeners to add logic in some parts of the test execution, therefore, you can detect when a test starts and finish.

The listeners are PHP classes that must implement the PHPUnit_Framework_TestListener interface, to use them you will need to create a XML configuration file passed as a param to the PHPUnit runner.

Type in your shell:

phpunit --configuration MyConfiguration.xml testsDirectory

Continue reading