Vstest: pass parameter to "dotnet test" execution

Created on 26 Jan 2017  路  3Comments  路  Source: microsoft/vstest

Description

I want to run a .net core NUnit test with the vstest.console.
This is working fine but I want to pass to the "dotnet test" execution a parameter, in my case "--no-build"
How I can parse this parameter to the dotnet execution? I have not found the right runsettings variable

Steps to reproduce

vstest.console.exe " "project.json" /UseVsixExtensions:true /Settings:settings.runsettings

Expected behavior

["C:\Program Files\dotnet\dotnet.exe" test "project.json" --port 55307 --no-build]

Actual behavior

["C:\Program Files\dotnet\dotnet.exe" test "project.json" --port 55307 ]

Environment

windows 7

project.json

{
"version": "1.0.0-*",

"dependencies": {
"NUnit": "3.5.0",
"dotnet-test-nunit": "3.4.0-beta-3"
},

"testRunner": "nunit",
"frameworks": {
"netcoreapp1.0": {
"imports": "portable-net45+win8",
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-*",
"type": "platform"
}
}
}
}
}`

Most helpful comment

@codito I'm using a csrpoj based project. How can I pass a command line argument to dotnet test and somehow read the value in my tests?

All 3 comments

@aumanjoa the support for passing arguments to adapters through vstest.console is supported only for csproj based test projects.

For project.json based test projects, please use the dotnet test command (that ships with dotnet-cli preview2) for this feature.

@codito many thanks for the answere.

@codito I'm using a csrpoj based project. How can I pass a command line argument to dotnet test and somehow read the value in my tests?

Was this page helpful?
0 / 5 - 0 ratings