Build/Test Issues

Is it possible to ignore/filter tests by execution time?

Started by milund on 2,492 views

Hi,

We have more than 5000 tests, in a great mixture of unit tests and integration tests - and no category attribute on the tests.
So it would be nice if ncrunch after first run could decide which tests to run continously (those faster than say 100mS) and ignore the rest.

Is that in any way possible?

Thanks,
Michael
Hi Michael,

Thanks for posting!

Yes, this is certainly possible. You'll need to create a custom engine mode, which needs to have the tests to execute automatically setting overridden, containing a filter by the execution time of the test. You might also want to add an extra condition on the filter so that NCrunch will also execute tests that haven't been executed yet, as otherwise the execution time won't become available.

I would generally recommend using categories if possible. This is because test execution time can be quite variable. If you have a unit test that has a single execution run over 100ms, NCrunch then won't run this unit test again until it's targeted manually and reruns with a lower execution time.

Post a reply

Log in to reply.