Home > Net >  How to run vstest using Linux agent in azure Release pipeline?
How to run vstest using Linux agent in azure Release pipeline?

Time:09-27

Problem statement: I have specflow tests written in .NetCore and used to run on windows based agents. Now I need to run these tests in linux agent.

I have used build pipeline with windows based agent to build the artifacts. Then in the Release pipeline I have added the vstest Task and Ubuntu agent as below

Agent Pool: Azure Pipelines

Agent Specfication: Ubuntu 20.04

When I run the pipeline the vstest task gave error as below

This task is supported only on Windows agents and cannot be used on other platforms

How to resolve this issue?

CodePudding user response:

You can't use vstest on Linux. vstest requires that either Visual Studio is installed or that you have the VS Test Platform installed.

If you want to use vstest you can change the Agent Specification to Windows.

CodePudding user response:

There is a work around to achieve this.

Add dotnet test Task and change the command to 'custom' instead of test and custom command as 'vstest'. The configuration looks as below

steps:
- task: DotNetCoreCLI@2
  displayName: 'dotnet custom'
  inputs:
    command: custom
    projects: '**/Tests.dll'
    custom: vstest
    arguments: '--logger:trx;logfilename=TEST.xml'
  timeoutInMinutes: 120
  • Related