Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Exclude tests based on wildcard
MatthewSteeples
#1 Posted : Thursday, February 28, 2019 3:05:30 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/28/2014(UTC)
Posts: 139
Location: United Kingdom

Thanks: 7 times
Was thanked: 18 time(s) in 16 post(s)
We've got a complex suite of integration tests that run in NCrunch on grid nodes that are based off 1 base class. The details (if relevant) are that we have 5 methods on the base class, and then each of our test files is a class that inherits from this class, which equates to (for example) 500 tests with 100 classes.

The scenario is that we'd like to stop just one of these methods from executing in NCrunch. We'd still like it to run on our build server (so don't want to apply the standard [Ignore]) and we don't really want to ignore them individually in the NCrunch config as that means whenever someone adds a new test class they'll have to ignore it.

It looks like there used to be a Regular Expression matcher for tests back in version 1 (if the forums are to be believed) and I wasn't sure if there was a way of being able to reproduce the behaviour. We only need to match an "EndsWith" pattern, as the method name is the same across all test classes.
Remco
#2 Posted : Thursday, February 28, 2019 9:40:22 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
There is a way to do this using the 'Tests to execute automatically' filter, but actually I think a cleaner way would be to do the following:

#if !NCRUNCH
[Test]
#endif
public void MyTestHere()
{
...
1 user thanked Remco for this useful post.
MatthewSteeples on 3/1/2019(UTC)
MatthewSteeples
#3 Posted : Friday, March 1, 2019 1:18:06 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/28/2014(UTC)
Posts: 139
Location: United Kingdom

Thanks: 7 times
Was thanked: 18 time(s) in 16 post(s)
That's exactly what I'm after. Better than my workaround of using a RequiresCapability for a capability that nothing provided. Thanks
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download