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

Notification

Icon
Error

Using Catagories
Aidan
#1 Posted : Wednesday, March 18, 2015 5:46:16 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/25/2013(UTC)
Posts: 5
Location: United Kingdom

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I have some tests that if they are run completely destroy my local database... an interesting decision by some previous developer!

In any case I need to run unit tests (nunit) like so [Test, Category("Unit test")]

I have set up an engine mode that has "automatic test filter" set to HasCatagory 'Unit test'

but it seems that all tests run anyway.

In the wizard there is no place where you select the mode, so I wonder if somthing there is setting it to "run it all" mode (though this is not reflected in the UI.)

Can someone walk me through the steps?
Remco
#2 Posted : Wednesday, March 18, 2015 10:36:47 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi, thanks for sharing this.

There were problems in earlier versions of NCrunch where it was possible for tests to land in the queue when they were supposed to be excluded using the engine mode. Can you confirm which version you're running?

The engine mode automatic execution filter will only apply to the automatic queuing of tests when changes are detected, it won't stop the tests from landing in the queue if you use the 'Run all tests' option, or if you target the tests specifically via context menu etc.

If you see the tests landing in the processing queue (and subsequently being run) without any action being taken on your part to run them, double-check which engine mode you have selected. NCrunch will usually remember the last selected engine mode between sessions, but there are situations where this can fail to work correctly (for example, if the config file is read-only).
Aidan
#3 Posted : Thursday, March 19, 2015 9:12:46 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/25/2013(UTC)
Posts: 5
Location: United Kingdom

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
If I use the resync button then that should only run tests filtered by the Engine Mode selected right?

I am a bit surprised that the 'Engine mode' does not trump anything else but an explicit "run this test" action. but I suppose I can see it is tricky to know the intent... and few people (I hope!) have 'tests' that actively harm a local install of the thing under test!
Remco
#4 Posted : Thursday, March 19, 2015 10:24:36 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Aidan;7086 wrote:
If I use the resync button then that should only run tests filtered by the Engine Mode selected right?


That's correct. If you have an active engine mode filter that should prevent these tests being run, and they are queued when you reset the engine, then it's a bug .. and I'll need more info on how to reproduce it :)

Aidan;7086 wrote:

I am a bit surprised that the 'Engine mode' does not trump anything else but an explicit "run this test" action. but I suppose I can see it is tricky to know the intent... and few people (I hope!) have 'tests' that actively harm a local install of the thing under test!


It's a hard one to get right, as everyone has different preferences and different test designs. I expect that the engine modes will become more powerful and configurable over time.. though of course this needs to be balanced against UI/configuration complexity (which is increasing rapidly).

You may also want to investigate using the 'Explicit' attribute on these tests. NCrunch should now handle Explicit tests correctly by not automatically executing them, and explicit tests are also excluded from the 'Run all tests' option.

Of course, the best approach is always to try and fix the tests. If you can get them using a different database instance, that would probably save you a great deal of confusion in future. It may be as simple as having an alternative connection string?

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.039 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download