views:

114

answers:

2

I need to run some code only if I'm running from within the TeamCity test launcher. What's the easiest way to detect this?

A: 

Check out this link TeamCity Test Reporting

Sergey Mirvoda
I don't see how this is relevant - I'd like to call a method from C# that returns true if I'm running within TeamCity.
ripper234
You can simply check one of Team City Environment Variables.
Sergey Mirvoda
as for relevance instead of using TC nunit launcher use can use console launcher with test result publishing and replace your workaround with my one.
Sergey Mirvoda
+3  A: 

Check if TEAMCITY_VERSION environment variable is defined. Another approach is to use NUnit categories.

Eugene Petrenko