Integration Tests

Developing Integration Tests

  • In the acceptanceTests module, Integration tests are are marked with a TestNG tag of "integration".
  • Integration tests can touch the the database following these guidelines:
    • Always set up all the data you expect in the database before the test, for instance, in a setUp() method. Do not depend on other tests setting up data for you! DbUnit and SimpleDataSet provide easy ways to do this.
    • Do not expect pre-loaded data. The acceptance tests and the automatic deploy to the test server have sql scripts that will pre-load data into the database, but the integration tests do not. This is by design.

Integration Tests in the Application Module

  • In the application module, Integration tests follow the naming convention _IntegrationTest (which extends MifosIntegrationTestCase) or _StrutsTest (which extends MifosMockStrutsTestCase), all currently use JUnit 3 (but will eventually be migrated to TestNG)
  • To run an individual integration test, use mvn integration-test -Dtest=TheNameOfYourTestClass, this will first invoke mvn pre-integration-test which refreshes the integration test database schema and data
  • To run individual integration test from Eclipse: right click on the test > Run As > JUnit Test, before running an integration test you need to execute the mvn pre-integration-test which sets the integration test database.

Also see: