ttutisani / Xunit.Gherkin.Quick

BDD in .NET Core - using Xunit and Gherkin (compatible with both .NET Core and .NET)
MIT License
205 stars 29 forks source link

Let ignoring scenarios using multiple @ignore tags. #151

Open farost opened 8 months ago

farost commented 8 months ago

Right now the library supports only ignoring scenarios using the @ignore tags. However, it is a practice for other BDD libraries to have a configurable list of tags to ignore. For example, Java's Cucumber is fully configurable for each test: tags = "not @ignore and not @ignore-custom and not @ignore-custom-something-else-whatever-you-want"

It is extremely useful for large projects. For example, when we have a number of clients for a single server, and we want to ensure that all our clients work identically. However, we want to temporarily disable some of the scenarios for specific clients, creating @ignore-client1 and @ignore-client2.

As adding such scalable feature requires time, I'd suggest to at least give developers a way to use several different tags.

ttutisani commented 8 months ago

My view:

ttutisani commented 8 months ago

Also, in some simple cases, organizing tests using tags can help. Those can already be passed in as arguments: https://github.com/ttutisani/Xunit.Gherkin.Quick/blob/master/docs/tags.md

farost commented 8 months ago

@ttutisani Maybe just a reversed "--filter" would be enough! Like "all except of ".

ttutisani commented 8 months ago

You made me think 🙂

So, good news, it's already possible because --filter takes an expression as an argument. So, if you want to ignore all tests annotated with @ignore-xxx tags, that means you want to run all tests that have tags that don't contain ignore. You write that like this:

filter Category!~@ignore

The only problem left is that this is not documented in the tags documentation, which is why this issue must stay open until it's documented.

Sources:

farost commented 8 months ago

I've tested the --filter flag. Here are my thoughts:

So any other option would be still helpful, I guess =)