Run tests affected by code changes first in TeamCity

1.4k views Asked by At

Using TeamCity, we want to run tests which are affected by code changes first.

NCrunch (http://ncrunch.net) and Mighty Moose (http://continuoustests.com/) provide solutions for that on a local development machine. Is there some solution for TeamCity?

Context: We are running many integration tests and programmers tests against our code base. It takes up to 4h to run all tests on the integration server. It runs on rather powerful hardware and there is not much room for improvement on that end. When a developer commits und pushes, it would be nice to get a quick feedback.

1

There are 1 answers

1
Pavel Sher On

To reduce overall tests duration, you probably can split your tests on two or even more parts and have separate build configuration in TeamCity for each part. Then you can create one more build configuration with snapshot dependencies on all these parts. Finally, you can add VCS trigger to this configuration with option to trigger on changes in dependencies. Build configurations actually running tests may not have triggers at all.

With this setup and enough agents you'll have several parts of your tests running in parallel. Note that snapshot dependencies results will be consistent, because when integration test build configurations are triggered, their revisions are fixed and will be the same for all triggered builds. The build configuration depending on test configurations may not have build steps at all, it's only task is to provide aggregated test results and triggering.

TeamCity also supports tests reordering for .NET and Java, you can read more about this feature in documentation: http://confluence.jetbrains.net/display/TCD65/Running+Risk+Group+Tests+First