Reputation: 4860
In our project, we have a plenty of unit tests. They help to keep project rather well-tested.
Besides them, we have a set of tests which are unit tests but depends on some kind of external resource. We call them external tests. For example, they can sometimes access web-services.
While unit tests are easy to run, the integrational tests couldn't pass sometimes: for example, due to timeout error. Also, these tests can take too much time to run.
Currently, we keep integration/external unit tests just to run them when developing corresponding functionality.
For plain unit tests, we use TeamCity for continuous integration.
How do you run the integration unit tests and when do you run them?
Upvotes: 6
Views: 10639
Reputation: 121
We use Jenkins to run our tests automatically.
Be careful of differencing between Unit and Integration - Tests. It is confusing to talk about "Integration Unit Tests"
Maven offers good support to distinguish between Unit and Integration Tests- Failsafe & Surefire Plugin.
From Apache Maven Project: The Failsafe Plugin is designed to run integration tests while the Surefire Plugin is designed to run unit tests. (see: http://maven.apache.org/surefire/maven-failsafe-plugin/) You need to configure these Plugins in your pom.xml
You then only use mvn test
- to run unit tests or mvn verify
to run integration tests.
Unit test should run periodically f.i. every 15 min. Integration Test, normally take long, and should run f.i. every 24 hours.
Hope that helps others.
Upvotes: 1
Reputation: 2736
In our project we have separate suite for regular/plain unit tests and separate suite for integration tests. The are two reasons for that:
We use TeamCity as our main Continuous Integration server and Maven as build system. We use the following algorithm to run the tests:
mvn clean install
The way we trigger integration tests execution is by configuring TeamCity's integration.tests task to be dependent on "main" continous.build task, see here for details: http://confluence.jetbrains.net/display/TCD4/Dependencies+Triggers
We run only integration tests (excluding unit tests) by:
Upvotes: 5
Reputation: 43709
We're using Maven2: maven-surefire-plugin to run unit tests (in the test phase) and maven-failsafe-plugin for integration tests (integration-test phase).
By default, all tests run when the project is built, however integration tests can be turned off using profiles.
In many cases integration tests are the part of the module, n some cases there are also dedicated modules which only do integration tests.
One of the teams also uses Fitnesse for acceptance testing. These tests are also in dedicated modules.
We're using Hudson for CI.
Upvotes: 3
Reputation: 392070
We run all the tests in one huge suite. It takes 7 minutes to run.
Our integration tests create mock servers. They never time out -- except when the test requires the server to time out.
So we have the following kinds of things. (The code sample is Python)
class SomeIntegrationTest( unittest.TestCase ):
def setUp( self ):
testclient.StartVendorMockServer( 18000 ) # port number
self.connection = applicationLibrary.connect( 'localhost', 18000 )
def test_should_do_this( self ):
self.connection.this()
self.assert...
def tearDown( self ):
testClient.KillVendorMockServer( 18000 )
This has some limitations -- it's always forking the client mock server for each test. Sometimes that's okay, and sometimes that's too much starting and stopping.
We also have the following kinds of things
class SomeIntegrationTest( unittest.TestCase ):
def setUp( self ):
self.connection = applicationLibrary.connect( 'localhost', 18000 )
def test_should_do_this( self ):
self.connection.this()
self.assert...
if __name__ == "__main__":
testclient.StartVendorMockServer( 18000 ) # port number
result= unittest.TextTestRunner().run()
testclient.KillVendorMockServer( 18000 )
system.exit( result.failures + result.errors )
To support this testing, we have a number of mocked-up servers for various kinds of integration tests.
Upvotes: 1