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 NCrunch Developer
#7084
18 Mar 2015 22:36 UTC
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).
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).
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!
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 NCrunch Developer
#7087
19 Mar 2015 10:24 UTC
Aidan 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 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?
Post a reply
Log in to reply.