-
Notifications
You must be signed in to change notification settings - Fork 115
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
No way to "skip" a test stating a reason #280
Comments
What do you think the best way to represent it is? How it should be show in the console is a good start. |
In the console it already shows in yellow, AFAIR, which is good. But it should state the reason of why the test is skipped. |
The short answer is that there isn't a reasonable way for me to add a new argument w/o hurting backwards compatibility etc, and I can explain why, and I can also give you a reasonable work around that you can use. functions like
Except that they called between the arguments Because of this they can only take 2 arguments. Adding a 3rd argument is not possible. What we can do is charge the signature to from
If I did this in canopy as a whole it would break everyone who had skips now. But I can help you make it work for you. Make a new file called something like Add this function:
This will let you write a test like this
Now any time you skip you will have to provide a reason to make the compiler happy. Does this help? |
This will help , especially if we are sharing the results with wide audience . Thank you Chris. |
That is completely understandable. But you could always create a new operator that accepts an argument, and make the previous one obsolete?
Thanks so much for the suggested workaround. However, after thinking a bit more about it, I would say that I wouldn't like the "new operator" solution either (the one I just suggested above), because of one reason: it's meant to make the test be skipped at "compilation time", let's say. But, if we look again at NUnit features, they even have this feature at run-time, thanks to |
You want something like this?
And it will mark the test as skipped? |
Yes, so that you could also call it conditionally, for example
Feel free to use |
You can download the latest version of canopy here: https://www.nuget.org/packages/canopy/0.9.58 just add
inside the function body of your test and it will skip that test at run time. |
Awesome thanks! |
I'm loving canopy. That being said, I'm not a fan of "magic". And by magic I refer to these magic operators: https://lefthandedgoat.github.io/canopy/testing.html
To argue my point, let's take the example of someone wanting to ignore/skip a test for some reason. There's the
&&!
operator, great... but how to attach that reason to the code? In NUnit, you have theIgnore(string)
attribute that accepts a way to encode the reason as a parameter.If I were NUnit's author, I would have gone even farther and not provide the parameterless
Ignore()
overload. I think canopy should do this as well.The text was updated successfully, but these errors were encountered: