rg702
rg702

Reputation: 92

Accessing NUnit Console include parameter name inside tests

I am using Specflow and firing the nunit-console.exe in TeamCity to run tests as follows: "C:\Program Files (x86)\NUnit 2.6.4\bin\nunit-console.exe" /labels /include:regression out=TestResultRegression.txt /xml=TestResultRegression.xml /framework=net-4.0 .\MyTests.dll

How can I access the NUnit include tag (/include:regression) so that I can call certain methods or properties for test setup (ex. If include = regression, then run this certain pull these certain test case ids from the app.config file where the key is "regression")

Upvotes: 0

Views: 81

Answers (1)

Charlie
Charlie

Reputation: 13736

There is no way in NUnit for you to know what runner is running you or how it is doing it. This separation of concerns is by design. You could, of course, access the command line that ran the tests and examine it, but I think that again forces the tests to know too much about their environment.

Best solution is to organize tests hierarchically so that all tests requiring a certain setup are in a namespace or fixture where that type of setup is performed.

Upvotes: 2

Related Questions