0
votes

I have a XAML build definition running my MSTest unit tests and it takes a long time to execute all of them. I have 4 build agents(VMs with 1 core each) setup in the build environment. I am using Microsoft.TeamFoundation.Build.Activities.RunAgileTestRunner activity in the XAML which is inside a "Run on Agent"(Microsoft.TeamFoundation.Build.Workflow.Activities.AgentScope) activity.

Currently, the unit tests execute on one of the agent. I want to be able to distribute the unit tests to other available agents. Is there a way to do that through TFS configuration or by changing the build definition.

As a workaround, I can split up the unit test project into multiple projects and run them separately on the available agents however I won't be able to see the build summary in one place.

What would be best possible solution for this?

1
How long do your tests take to run? Can you split the tests into during and post build?Joshua Drake
22 hours(I know, I know, these are more of integration tests than unit tests but that's a different story). Can you give more information on how to split the tests into during and post build?DevOpsy
You should work on trimming those down/making them run faster before doing anything else. After that you should consider moving them to post deployment testing.Joshua Drake
Yes, that is the plan. However, I have my other 3 build agents sitting idle while the first build agent runs those tests. It makes logical sense to split the test execution among the build agents to speed up the execution with minimum changes to the underlying tests.DevOpsy
Except that's not exactly what those agents are for, though I understand the desire to use all the "threads" available. The problem is that if you want to be able to fail/rollback based on the tests you need them to be inline with the build/deployment that they are tied to.Joshua Drake

1 Answers

1
votes

Just check this article : How to run automated tests on different machines in parallel?

The Recommended option:

  • Create multiple environments with each environment consisting of single machine (read single agent).

  • Divide all your test cases onto different sets and queue one set on one environment and other set on other environment and so on.

  • With this each set of test will run in parallel and on different machine.

Also reference below articles:


Besides, If upgrading to VNext build is an option, then you can easily achieve that by following the steps mentioned in below articles: