A.D.
A.D.

Reputation: 435

Configuring parameters for NUnit tests in TeamCity

Is there a way to configure parameters from the TeamCity UI, that can be accessed from .Net code during the NUnit test run?

Right now I know that it's possible to set an environmental variable in TC and then use it in the unit tests.

I would like to be able to quickly copy build configuration settings in teamcity, configure the tests differently and then run the build.

Thanks AD

Upvotes: 1

Views: 715

Answers (2)

Boris Modylevsky
Boris Modylevsky

Reputation: 3099

I agree with @vikram, this is a good option. I will suggest another one. You may reference FluentTc library, which allows programmatic access to TeamCity parameters.

var buildId = new LocalTc().GetBuildParameter("build.id");

The package is available on nuget

Upvotes: 1

vikram
vikram

Reputation: 14

I think you need this.. may be..

  • Create a config file that is read by your .net code before executing the test
  • Update the contents of the config file from TC (using parameters) before any build steps are executed using the file content replace build feature.
  • Run the build from TC with default parameters (run custom build if you would like to change any specific parameter instead of default)

Upvotes: 0

Related Questions