0

I have to execute automation tests from Jenkins and I want to pass parameters such as Environment and InstanceID. How do I pass it along with the Dotnet test command? I am using the NUnit Dotnet core framework and using the app.config/web.config file to pass all the parameters in the code. We don't use the runsetting file. Is there any way to pass the parameter in the Dotnet test command. Here's the command i am using currently:

dotnet test --filter TestCategory=RegressionTest --logger:"trx;logFileName=%WORKSPACE%\Build%BUILD_NUMBER%TestResults.trx"
Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
Pa1509
  • 9
  • 2
  • 1
    .NET Core doesn't use the old app.config/web.config files. You had to add extra code to read configuration settings from there, or migrated a .NET Old project. .NET Core's configuration system already loads settings from the command line, environment variables, JSON, XML, INI files or even databases and remote systems, provided you use the correct configuration. The default configuration uses `appsetgings`, environment variables and command-line arguments – Panagiotis Kanavos Sep 25 '20 at 09:57
  • Does this answer your question? [How to pass parameters to the dotnet test command while using NUnit or XUnit](https://stackoverflow.com/questions/54064138/how-to-pass-parameters-to-the-dotnet-test-command-while-using-nunit-or-xunit) – Panagiotis Kanavos Sep 25 '20 at 10:00
  • Since you added the `jenkins` tag, it would be easier to pass arguments as environment variables and read them in the tests. If you use .NET Core's configuration system, you'd only need [to ensure the environment variable names can be recognized by .NET Core](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1#environment-variables) – Panagiotis Kanavos Sep 25 '20 at 10:03

0 Answers0