Integrating JUnit tests inside a PHPUnit+Selenium test suite

I’ve spent some time recently integrating the OSLC open source test suite (from the OSLC open source support project)into the FusionForge test suite.

FusionForge‘s test suite uses PHPUnit to drive Selenium (RC) “end user” like tests. Selenium is a tool that makes such tests possible by piloting an instance of FireFox browsing the Web interface of the forge, in a controlled environment.

The OSLC test suite consists in a series of JUnit tests, which is driven by Maven (initially started from inside Eclipse, then also from command-line after I found the nasty command line parameters and changes in the pom.xml file that were required ;).

The whole of the test suite may not pass for our implementation of OSLC-CM in FusionForge, so some tests fail, but I don’t bother too much as this is “normal”, and all we’re caring for at the moment is mainly non-regression. There seemed to be no way to exclude some of the tests from the suite for the moment, but fortunately, that doesn’t matter, since the way I have integrated both test suites happens to allow the verification of only success on some of the tests.

So, the way they are integrated is through execution of the JUnit suite during one of the test cases of the Selenium suite (using a system( ) PHP call), which generates an HTML report (using the Maven SureFire reports plugin), which can then be viewed in the Web pages of the tested forge, so that Selenium + PHPUnit assertions can verify the content of the test report.

This is a bit hackish, but all in all suites our needs so far. Next step is to see if it works in other people’s test environments, including the automated executions in Hudson.