Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let ignoring scenarios using multiple @ignore tags. #151

Open
farost opened this issue Mar 14, 2024 · 5 comments
Open

Let ignoring scenarios using multiple @ignore tags. #151

farost opened this issue Mar 14, 2024 · 5 comments

Comments

@farost
Copy link
Contributor

farost commented Mar 14, 2024

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.

  • Ideally: send a list of tags to be ignored as arguments.
  • Faster: ignore all scenarios with tags @ignore*********.
@farost farost changed the title Let ignoring scenarios using @ignore*** tags. Let ignoring scenarios using multiple @ignore tags. Mar 14, 2024
@ttutisani
Copy link
Owner

My view:

  • List of tags to ignore as arguments - yes.
  • Ignore all tags based on tag name pattern - no. This will create a loosely-defined, implicit convention, which I always try to avoid.

@ttutisani
Copy link
Owner

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
Copy link
Contributor Author

farost commented Mar 15, 2024

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

@ttutisani
Copy link
Owner

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
Copy link
Contributor Author

farost commented Mar 18, 2024

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

  • It filters out tests from consideration completely, so the filtered tests are not shown in the stats of "Skipped", which is a shame;
  • The runner has troubles with ! and Bash. ! is a reserved symbol for Bash, so we need to escape it \!, but then the runner says that something is bad with my pattern: [xUnit.net 00:00:00.6207380] Xunit.Gherkin.Quick.ProjectConsumer: Exception filtering tests: Incorrect format for TestCaseFilter Error: Invalid Condition 'Category!~@ignore'. Specify the correct format and try again. Note that the incorrect format can lead to no test getting executed.;
  • It is a dotnet CLI flag, and it's not scalable for other builders (for example, I use Bazel, and its rules either don't use dotnet under the hood (which is a surprise) or don't pass the args to it (which is a double surprise).

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants