Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run some tests only in azure devops CI env but not locally

I would like to specify some long-running c# project xUnit tests to only run in azure devops CI pipeline, but not when a click 'Run All' in Visual Studio locally (vs2019). Is there a 'best practice' for this kind of behaviour?

I played around with making a test playlist and running that locally instead of Run All, but that would require updating the list (or lists) everytime i add new tests and this is error-prone.

like image 657
anonymousdotnetdeveloper666 Avatar asked Jun 14 '19 07:06

anonymousdotnetdeveloper666


1 Answers

AzureDevOps defines some environment variables. I would use TF_BUILD in conjunction with Ruben Bartelinks answer.

Set to True if the script is being run by a build task.

This variable is agent-scoped. It can be used as an environment variable in a script and as a parameter in a build task, but not as part of the build number or as a version control tag.

like image 147
Sebastian Segerer Avatar answered Sep 21 '22 17:09

Sebastian Segerer