This documentation relates to last stable version of Cipango.
visit the last unstable documentation home.
How to run integration tests within Cipango ?
The combination of Cipango Maven Plugin and Sip Unit allows to create tests for every possible call flow.
The principle is in phase "pre-integration-test" to start Cipango server, then in next phase the SIP unit tests are executed and in post-integration-test phase, Cipango is stopped. This allows to test the application and the container (Cipango) using real SIP messages.
To add integration tests in your project, you should add the following xml to your pom.xml
and create a new SIP unit test case in src/test/java/org/yourproject/sipunit
.
To run integration tests, execute the command
mvn install -Ditest
Maven configuration
<build> <plugins> <plugin> <groupId>org.cipango</groupId> <artifactId>cipango-maven-plugin</artifactId> <configuration> <stopKey>foo</stopKey> <stopPort>9999</stopPort> </configuration> </plugin> <!-- Tests in package sipunit are integration tests and so should not be run in maven test phase but in phase integration-test --> <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <excludes> <exclude>**/sipunit/**</exclude> </excludes> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.cafesip</groupId> <artifactId>sipunit</artifactId> <version>0.0.7b</version> <scope>test</scope> </dependency> </dependencies> <!-- Integrations tests are defined into a profile to allow to install the SIP application without running them. --> <profiles> <profile> <id>itest</id> <activation> <property> <name>itest</name> </property> </activation> <build> <plugins> <plugin> <groupId>org.cipango</groupId> <artifactId>cipango-maven-plugin</artifactId> <executions> <execution> <id>start-cipango</id> <phase>pre-integration-test</phase> <goals> <goal>run</goal> </goals> <configuration> <overrideSipXml>${project.build.testOutputDirectory}/integration/sip-override.xml</overrideSipXml> <scanIntervalSeconds>0</scanIntervalSeconds> <daemon>true</daemon> </configuration> </execution> <execution> <id>stop-cipango</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <executions> <execution> <id>surefire-it</id> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> <configuration> <excludes> <exclude>none</exclude> </excludes> <includes> <include>**/sipunit/**</include> </includes> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles>