-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Core] Add --wip option #1381
[Core] Add --wip option #1381
Conversation
@@ -24,7 +25,8 @@ public void receive(TestCaseFinished event) { | |||
} | |||
}; | |||
|
|||
ExitStatus() { | |||
ExitStatus(boolean wip) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both wip and strict are derived from RuntimeOptions. It is okay to inject the whole runtime options here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is done
Add whole RuntimeOptions
private boolean hasAlwaysOkStatus() { | ||
return is(Result.Type.PASSED) || is(Result.Type.SKIPPED); | ||
public boolean isOkWip(boolean isStrict) { | ||
return hasAlwaysOkStatus(true) || !isStrict && hasOkWhenNotStrictStatus(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this method is needed.
When using --wip
the build should fail when there are any passing results (when result.isOk(true/false) return true).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using --wip the build should fail when there are any passing results (when result.isOk(true/false) return true).
Are you sure ?
Because if I do this, when it return false for undefined in strict mode I attempt to obtain result 1 but I get 0 (with my current code, that are not currently pushed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mpkorstanje If I only use isOk, and I do what you tell, I obtain an unexpected behaviour with strict mode.
With wip and strict, if I have an undefined step, the result is 0 instead of 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it wasn't possible to use wip and strict in together. But if it is, that makes sense. An undefined result in strict mode makes the test fail. So when running with wip and strict it should pass. That is what I get from reading work_in_progress.feature:
In order to ensure that feature scenarios do not pass until they are expected to
Developers should be able to run cucumber in a mode that
- will fail if any scenario passes completely
- will not fail otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, do you want I disable the use of strict with wip ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you think the behaviour is unexpected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned somewhere else that I couldn’t remember why we disallowe strict and wip at the same time.
If we can’t think of a good reason for it (I can’t) we should allow it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking the same thing. But I am trying to work out why Heziode thinks the result of combining wip and strict with an undefined result is unexpected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a result I want to expect:
--wip
: Test fail only if one or more scenario have statusPASSED
--wip
+--strict
: Test fail if one or more scenario have status different thanFAILED
What do you think about this ?
public byte exitStatus() { | ||
return results.isEmpty() || | ||
(runtimeOptions.isWip() ? max(results, SEVERITY).isOkWip(runtimeOptions.isStrict()) : | ||
max(results, SEVERITY).isOk(runtimeOptions.isStrict())) ? 0x0 : ERRORS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's okay to use if statements here. You can use guard clauses to handle the empty case and the wip case.
I also think this will fail when there is one test case that passes and one test case that failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test case to prove it works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I can add test to check this, but… where I write it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In runtime test. But you have to test with moire then one event on the bus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is (normally) fixed with 99e535e
Well I made a table. I used the work_in_progress.feature for the | --wip | --no-wip |
| --strict | --no-strict | --strict | --no-strict |
PASSED | fail | fail | pass | pass |
SKIPPED | ? | ? | pass | pass |
PENDING | ? | pass | fail | pass |
UNDEFINED | ? | pass | fail | pass |
AMBIGUOUS | ? | pass | fail | fail |
FAILED | pass | pass | fail | fail | The question mark at You can however skip steps in java using A: | --wip | --no-wip |
| --strict | --no-strict | --strict | --no-strict |
PASSED | fail | fail | pass | pass |
SKIPPED | ? | fail | pass | pass |
PENDING | ? | pass | fail | pass |
UNDEFINED | ? | pass | fail | pass |
AMBIGUOUS | ? | pass | fail | fail |
FAILED | pass | pass | fail | fail | Interesting here is that B: | --wip | --no-wip |
| --strict | --no-strict | --strict | --no-strict |
PASSED | fail | fail | pass | pass |
SKIPPED | ? | pass | pass | pass |
PENDING | ? | pass | fail | pass |
UNDEFINED | ? | pass | fail | pass |
AMBIGUOUS | ? | pass | fail | fail |
FAILED | pass | pass | fail | fail | You can also make an argument for this. When work is in progress you wouldn't expect a the build to fail because you made a scenario pass by skipping it entirely. And again the wip mode more stricter then strict (and inverted).
That would also be a logical alternative. B2: | --wip | --no-wip |
| --strict | --no-strict | --strict | --no-strict |
PASSED | fail | fail | pass | pass |
SKIPPED | fail | pass | pass | pass |
PENDING | fail | pass | fail | pass |
UNDEFINED | fail | pass | fail | pass |
AMBIGUOUS | fail | pass | fail | fail |
FAILED | pass | pass | fail | fail | @Heziode What use case did you have in mind here? @aslakhellesoy what kind of work flow was wip supposed to support anyway? |
@mpkorstanje The option B2 is what I expect. But, in what use case use |
Let's go for option B2 then. Basically just ignore strict when wip is active. | --wip | --no-wip |
| --strict | --no-strict | --strict | --no-strict |
PASSED | fail | fail | pass | pass |
SKIPPED | pass | pass | pass | pass |
PENDING | pass | pass | fail | pass |
UNDEFINED | pass | pass | fail | pass |
AMBIGUOUS | pass | pass | fail | fail |
FAILED | pass | pass | fail | fail | A very concise way to check if the least severe result is a passed would be: |
Spec: | --wip | --no-wip | | --strict | --no-strict | --strict | --no-strict | PASSED | fail | fail | pass | pass | SKIPPED | pass | pass | pass | pass | PENDING | pass | pass | fail | pass | UNDEFINED | pass | pass | fail | pass | AMBIGUOUS | pass | pass | fail | fail | FAILED | pass | pass | fail | fail |
It is done. |
Looks good. I'll try to merge this and the runtime constructors branch later this week. |
Alright. I had some spare time. It has been merged. Thanks for contributing! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This feature is the java implementation of
--wip
of Cucumber-Ruby. But, instead of not support--wip
with--strict
(in Ruby version), this version do itHow Has This Been Tested?
I have do tests in:
Test in ExitStatus are not relevant here because it is tested in Runtime, isn't it ?
Types of changes
Checklist: