Skip to content

Conversation

@APErebus
Copy link
Contributor

@APErebus APErebus commented Dec 8, 2025

To support parallel tests in TeamCity, we need to identify and parse the excludedTests.txt file that TeamCity generates for each parallel build. When teamcity splits the tests up for parallel builds, it sends an exclusion list to each parallel batch. It's in a format such as

#version=1
#algorithm=duration
#current_batch=1
#total_batches=10
#suite=Calamari.Tests
Calamari.Tests.AWS.AwsEnvironmentGenerationFixture
Calamari.Tests.AWS.S3.BucketKeyProviderFixture
Calamari.Tests.AWS.S3.S3ObjectExtensionsFixture
...

To correctly filter the tests for each batch, we build a .runSettings file and build a Nunit Where query that is the original filter plus all the excluded tests identified by TeamCity.

Testing on TeamCity reduces the full chain time by approx. 20-30min.

It results in the same amount of tests being executed as on main

image image

var filePath = RootDirectory / "excluded.runSettings";
File.WriteAllText(filePath, runSettingsFile);

TeamCity.Instance.PublishArtifacts(filePath);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Publish the exclusion file for debugging


static string? TryBuildExcludedTestsSettingsFile(string baseFilter)
{
var excludedTestsFile = Environment.GetEnvironmentVariable("TeamCityTestExclusionFilePath");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is added via a teamcity build template on the specific test build config

@APErebus APErebus marked this pull request as ready for review December 9, 2025 05:08
Copy link
Contributor

@Jtango18 Jtango18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a useful change, Ship it!

@APErebus APErebus merged commit 16092b4 into main Dec 10, 2025
41 checks passed
@APErebus APErebus deleted the ap/parallel-tests branch December 10, 2025 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants