Running Unit Tests
[fleXive] (version 3.1+) comes with a bundled OpenEJB container to be able to run unit tests.
To run H2 unit tests follow these instructions (for MySQL just change the sections accordingly):
- Check out the sources as described in Checking out.
- In the root directory, copy build.properties.sample to build.properties
- If you want to use the bundled H2 database, comment out the last line in build.properties and enable the H2 database. The end of the file should look like this:
...
#select the database vendor to use
database.vendor=H2
#database.vendor=MySQL
- Copy lib/openejb-3.1/openejb-tests.conf.xml.sample to lib/openejb-3.1/openejb-tests-H2.conf.xml
- Comment out the MySQL configuration in lib/openejb-3.1/openejb-tests-H2.conf.xml and enable the H2 config to create a file similar to this:
<?xml version="1.0"?>
<openejb>
<!-- H2 settings -->
<Resource id="jdbc/flexiveConfiguration" type="DataSource">
JdbcDriver org.h2.Driver
JdbcUrl jdbc:h2:tcp: UserName sa
Password
</Resource>
<Resource id="jdbc/flexiveTest" type="DataSource">
JdbcDriver org.h2.Driver
JdbcUrl jdbc:h2:tcp: UserName sa
Password
</Resource>
<SecurityService id="Default Security Service"/>
<Deployments jar="../../build/framework/jar/flexive-ejb.jar"/>
<!--TransactionService id="Default Transaction Manager"/-->
</openejb>
- Start the H2 database by executing
 | Please run ant h2.start and do not start H2 manually, since launching from the build file will make sure the needed stored procedures are available! |
To finally run the tests either execute
for all tests or specify the groups to run (search in this example):
ant tests.groups -Dtests.groups=search
For other available targets please see the section Build Targets.
Running Unit Tests in the [fleXive] Backend Application
In order to run the unit tests within the [fleXive] BE the "Testrunner" plugin must be compiled and deployed with the flexive.ear package.
Execute the following ant target to have access to the Testrunner plugin:
ant tests.package.ear build-deploy
 | Make sure to create the flexiveTest database schema before starting up by issuing the ant target |
After starting up [fleXive] and logging in with superuser credentials you will find a "Testrunner" submenu within the "System" menu (Administration tab):
