简体   繁体   中英

How to pass TestRunParameters to “dotnet test” command directly from command line

Below is runsettings files, having custom parameters defined. <?xml version="1.0" encoding="utf-8"?> <RunSettings> <TestRunParameters> <Parameter name="publishResults" value="true" /> </TestRunParameters> </RunSettings>

This is how I run command from command line dotnet test MyTests --settings develop.runsettings --no-build

I want to avoid.runsettings and like to run like this dotnet test MyTests --publishResults true --no-build

Is it possible?

Yes, it is possible, but your syntax is incorrect. From this documentation, you would call it like so:

dotnet test MyTests --no-build -- publishResults=true

Observe that the RunSettings argument is the last passed-in argument. Also observe that there is a space between the -- and the publishResults=true . This space specifies that arguments that come afterward are used for RunSettings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM