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

Enhancement to allow to skip a test from the code #565

Closed
juliangp opened this issue Jun 8, 2023 · 8 comments · Fixed by #568
Closed

Enhancement to allow to skip a test from the code #565

juliangp opened this issue Jun 8, 2023 · 8 comments · Fixed by #568

Comments

@juliangp
Copy link

juliangp commented Jun 8, 2023

🤔 What's the problem you're trying to solve?

We require the means to skip a test from the code. Here are a couple of examples:

  1. We run tests that require an environment variable, if that variable is not set then we want to skip the test.
  2. We run tests to check tls ciphers on a server for a given tls version, if the server does not support that tls version then we want to skip the test.

✨ What's your proposed solution?

The proposed solution is to have an error (something like godog.SkipTest) that can be returned from the code and that will mark the test/scenario as skipped but not as failed.

⛏ Have you considered any alternatives or workarounds?

For now we have a test context where we set a flag and then we have to add code to skip all godog methods if flagged.
This has the disadvantage that the test is not marked as skipped.

📚 Any additional context?


This text was originally generated from a template, then edited by hand. You can modify the template here.

@roskee
Copy link
Member

roskee commented Jun 8, 2023

Perhaps you can use the godog.ErrPending error so that the test passes with a warning.

@juliangp
Copy link
Author

juliangp commented Jun 9, 2023

@roskee unfortunately that marks the tests as failed which is not what I want. I would like something similar, the only difference is that the tests are not marked as failed. I could probably provide a PR for this if required?

@longyue0521
Copy link
Member

@juliangp maybe you can use --godog.tags=~@skip,run tests that without skip tag

@juliangp
Copy link
Author

@juliangp maybe you can use --godog.tags=~@skip,run tests that without skip tag

@longyue0521 We already use this but we need something dynamic in the test, for instance when starting a test, for a given model, the server might return that the model is not deployed on the server, in this case we want to skip the rest of the test.

@juliangp
Copy link
Author

@vearutop Thank you!

@juliangp
Copy link
Author

@vearutop do you know if there is a new release planned soon that will contain this feature? Thanks in advance.

@vearutop
Copy link
Member

Indeed, there were a few nice improvements lately, let's make a new release.

@vearutop
Copy link
Member

v0.13.0 tagged.

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

Successfully merging a pull request may close this issue.

4 participants