Build/Test Issues

There is no way to ignore categories in the engine mode

Started by Amir Kolsky on 857 views

Unlike what the documentation says.
This is absolutely possible.

Go to NCrunch->Set Engine Mode->Customise Engine Modes

Then choose the engine mode you want to ignore categories in.

On the bottom pane, under 'Settings to be overidden by this engine mode', go to Filters->Tests to execute automatically.

Click the pencil.

Click add condition.

Use 'does not have category', and enter the name of your category. Save all changes.

When this engine mode is active, the engine will not automatically execute tests marked with the specified category.
So I have done exactly that. I have the [TestCategory("Playwright")] on both "Tests to execute automatically" and "Tests to execute on this machine" I have "When DoesNotHaveCategory 'Playwright'.
Verified that the Engine mode is 'Run impacted tests automatically, others manually. Ignore Playwright tests.'
None of the Playwright tests are ignore whether the category is on the class or on the method.

In the code it looks like this - [TestCategory("Playwright")]
[TestMethod]
public async Task ConnectButtonDisabledWithDefaultValue_Playwright()

Edited

Thanks for sending through the bug report. This was very useful!

The report indicates values for the two major settings you're working with under your engine mode:
Tests to execute automatically = 'True'
Tests to execute on this machine = 'DoesNotHaveCategory 'Playright''

It looks like there's a typo in the second setting. The first doesn't seem to be effective at the moment ('True' will just run every test).

I'm wondering if you've also been able to check the Category column in the Tests Window to make sure the category is being correctly applied to the tests in question. There's a bit of complexity around how categories are assigned, especially when inheritance is involved, so this is worth checking. Note that the evaluation for category names in NCrunch's execution plan is not case sensitive, but it does need to be precise (i.e. no trailing or leading spaces, etc).
This is strange, as when I look at the filter in the engine mode (both of them) it shows Playwright. In the configuration i did have Playright. So the value in the configuration overrides the engine mode. Got it. I'll try to see if the tests still run. Thank you.

Edited

Sometimes it can be worth experimenting with a small sample solution with minimal complexity to see if you can make the settings work in the way you expect them to. This can also be useful for reporting defective behaviour, as you can just submit the test solution through the NCrunch contact form and I'll be able to use it to reproduce the issue.
This post has been deleted.
This post has been deleted.

Post a reply

Log in to reply.