Testing FOP

FOP trunk, as of r1178747, has upgraded the unit test framework to JUnit 4. With this, there are a few changes made to how developers write unit tests. Here is a brief synopsis of some of the new features in JUnit 4:

Mocking Framework

As of r1204457 mockito has been added to the testing library class path. The link provided has plenty of information and a brief tutorial to help developers starting to use mocking in their tests.

Code Coverage

As of r1203749 FOP uses Jacoco for code-coverage analysis. There are several things that must be done before Jacoco can be run, firstly the developer needs to download Jacoco and specify the directory of the JAR to give build.xml access to it. This is preferably done by adding the $jacocoant.jar property to build-local.properties which will be consumed by jacoco.xml. Then, the ant -f jacoco.xml clean coverage-report command can be used to invoke code coverage analysis. The results are output in HTML format to the build/report_jacoco/ directory.

HowTo/CreateUnitTests (last edited 2011-11-21 15:46:34 by spc3-bagu2-0-0-cust872)