Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber - How to mark expected fails as known issues?

I successfully use Cucumber to process my Java-based tests.

Sometimes these tests encounter regression issues, and it takes time to fix found issues (depending on issue priority, it can be weeks or even months). So, I'm looking for a way to mark some cucumber tests as known issues. Don't want these tests fail the entire set of tests, just want to mark them, for example, as pending with yellow color in report instead.

I know that I can specify a @tag for failed tests and exclude them from execution list, but that's not what I want to do as I still need these tests to be run continuously. Once the issue fixed, appropriate test should be green again without any additional tag manipulation.

Some other frameworks provide such functionality (run the test but ignore its result in case of fails). Is it possible to do the same trick somehow using Cucumber?

The final solution I use now - to mark known issues with specific tag, exclude these tests from regular round and to run them separately. But that's not the best solution I believe.

Any ideas appreciated. Thanks in advance.

like image 850
Konstantin Dobroliubov Avatar asked Nov 08 '22 11:11

Konstantin Dobroliubov


1 Answers

I would consider throwing a pending exception in the step that causes the known failure. This would allow the step to be executed and not be forgotten.

I would also consider rewriting the failing steps in such a way that when the failure occurs, it is caught and a pending exception is thrown instead of the actual failure. This would mean that when the issue is fixed and the reason for throwing the pending exception is gone, you have a passing suite.

Another thing I would work hard for is not to allow a problem to be old. Problems are like kids, when they grow up the they get harder and harder to fix. Fixing a problem while it is young, perhaps a few minutes, is usually easy. Fixing problems that are months old are harder.

like image 69
Thomas Sundberg Avatar answered Nov 14 '22 21:11

Thomas Sundberg