1
votes

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

2
After a brief investigation I found out that having the teamCity build template having all environmental variables handled by my tests pre-defined is a pretty good choice. When I create a new build out of this template, all the settings are there on teamcity website.A.D.

2 Answers

1
votes

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

0
votes

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)