Skip Test step if no test assemblies found?

We have a template that is used on all of our project that has a test step.  For the vast majority of our configurations we have tests associated with the build.  A small number have no tests.  We could disable the test step for these configurations, but would need to realize/remember that the step is disabled as soon as the first test is added.  Ideally we would like a way to not fail if no tests are found.  Is there a way to do this?

0
2 comments

Sorry should clarify, this is NUnit test step.

0

Hello Matthew,

Can you programmatically find out if project in question has any tests defined? If yes, I can think of a workaround where you add a build step condition based on parameter value to the NUnit runner step. Suppose you have a new boolean parameter:

shouldRunTests: false

You could then have another build step running at the start of the build which would check if any tests are available for running. If there are any, this new step could update the parameter via service message:

##teamcity[setParameter name='shouldRunTests' value='true']
The NUnit step could check if shouldRunTests is set to true, and run the step only when this condition is met. 
Please let me know if this helps.
0

Please sign in to leave a comment.