-
Notifications
You must be signed in to change notification settings - Fork 18
UnitTesting
DSpace is using Maven SureFire plugin to run the tests. This plugin can be used to run tests prepared in different frameworks like JUnit or TestNG or execute simple POJOs. SureFire plugin needs to be included in the pom.xml file. Which in DSpace is the top level pom.xml (and also dspace/modules/xmlui/pom.xml which is probably not necessary due to pom.xml inheritance).
All the tests are by default run in the test phase. But in DSpace they are skipped due to the following configuration parameter in main pom.xml:
<!-- skip tests by default, but allow override
on command line by setting property "-Dmaven.test.skip"-->
<!-- Disabled by default, change activeByDefault to true to enable -->
<profile>
<id>skiptests</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
</profile>
So in order to run the test, one must use:
mvn test -Dmaven.test.skip=false
As tests are just pieces of ordinary software that needs to be debugged it is a common request to run single test only. This can be done by issuing
mvn -q test -Dmaven.test.skip=false -Dtest=$TEST_CLASS
For each test there is a report generated in $DSPACE_SOURCE/$MODULE/target/surefire-reports/