0

I have a build process in which I have a couple of Tests Tasks. Some of them may become quite time consuming when they all run and most of the time, most tests are not expected.

Still, I would like to have ALL these tests run on a scheduled trigger.

I know I could simply clone the pipeline and use one for gating with impacted tests only and the other one for schedule with all tests but as an OO developer, I don't like this.

I already tried linking the checkbox parameter to a process variable and modifying it using PowerShell but failed to have it work (How can I modify a process variable using Powershell in a Azure build pipeline).

Isn't there any other way of doing this?

1
  • some solutions were provided in the thread you mention above. You can go and check it out. Commented Nov 9, 2019 at 8:16

2 Answers 2

1

You may be able to do this by setting the following condition on the test tasks that you'd only like to run during the scheduled build:

eq(variables['Build.Reason'], 'Schedule')

See here for a list of predefined variables (search for 'Build.Reason'):

https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml

See here for more information on expressions:

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops

Sign up to request clarification or add additional context in comments.

2 Comments

The thing is that this would mean duplicating the test tasks and have one that runs the impacted tests on CheckIn and another one that runs everything for everything else. I was looking for a solution without duplicate.
I suppose I'm a bit unclear as to what you are interested in accomplishing. You might consider making your tests YAML steps templates. That way you can re-use the steps with a simple - template: /path/to/test-steps.yml. Since the test steps are captured as template(s) you shouldn't need to duplicate much in your individual pipelines.
1

It looks like functionality for this is now built in. According to the docs a variable can be set which will cause all tests to be run:

By setting a build variable. Even after TIA has been enabled in the VSTest task, it can be disabled for a specific build by setting the variable DisableTestImpactAnalysis to true. This override will force TIA to run all tests for that build. In subsequent builds, TIA will go back to optimized test selection

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.