Hello,First of all, thanks for this wonderful framework.Step execution results can have two main states: PASSED or FAILED (if we ignore PENDING, SKIPPED, UNDEFINED, etc.).I'd like steps to have another middle state: WARN.This state would threat the step as FAILED but will not skip the execution of the following steps.Here is why:I have such a scenario:When I go to the category page "CATEGORY ONE" of my websiteThen The product "VISIBLE 1" is "Visible"And The product "VISIBLE 2" is "Visible"And The product "NOT VISIBLE 1" is "Not visible"And The product "NOT VISIBLE 2" is "Not visible"
This is one scenario for speed reasons:All products are (or are not) on the page: we load the category page once.If we divide the scenario in 4 (with eg. an "Examples:" section), we would load the category page 4 times (we cannot have a Background section because the .feature file has more scenarios that don't share that background).And this scenario is quite simple, but in real life we get more complex scenarios that navigate through several pages and have additional OPTIONAL assertions on each page: such assertion failures should be reported as errors, but the test must continue in order to spot all assertion failures, and not stop at the first failure and hide other potential failures...Is it possible for a future version of Cucumber to add such FAILED step that continues to execute the next steps?So that an optional assert failure will not hide other failures by not executing their steps.This could be done with an annotation like that:@WarningInsteadOfFailure@Then("^The product " + PLACEHOLDER_STRING + " is " + PLACEHOLDER_STRING + "$")public void the_product_is(String productName, Visibility visibility) {assertThat(page(CategoryPage.class).getProduct(productName) != null).isEqualTo(visibility.isVisible());}Or this could be more fine-grained:Instead of a @WarningInsteadOfFailure annotation, we could request only specific exceptions to be treated as warnings:@WarningInsteadOfFailure({AssertionError.class, NoSuchElementException.class})What do you think about this proposal?Have a nice day,Sébastien Laoût.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On 28 January 2016 at 10:19, <external...@decathlon.com> wrote:Hello,First of all, thanks for this wonderful framework.Step execution results can have two main states: PASSED or FAILED (if we ignore PENDING, SKIPPED, UNDEFINED, etc.).I'd like steps to have another middle state: WARN.This state would threat the step as FAILED but will not skip the execution of the following steps.Here is why:I have such a scenario:When I go to the category page "CATEGORY ONE" of my websiteThen The product "VISIBLE 1" is "Visible"And The product "VISIBLE 2" is "Visible"And The product "NOT VISIBLE 1" is "Not visible"And The product "NOT VISIBLE 2" is "Not visible"For speed, simplicity, and maintenance I would write this scenario with a single Then e.g.Then the correct products should be displayed
And then implement that in a way that eloquently expresses the idea that some products should be there and some shouldn't e.gThen "the hidden products should hidden and visible products should be visible" do
@apremdas:Ah, that's a good idea.Do you mean that:Given These products should be hidden:| NOT VISIBLE 1 || NOT VISIBLE 2 |And These products should be visible:| VISIBLE 1 || VISIBLE 2 |When I go to the category page "CATEGORY ONE" of my websiteThen Then hidden products are hidden and visible products are visible
That solve one of my use cases.Thanks.Though, this needs some work in step definitions in order to create a human readable message aggregating all failures: "The products {1} are visible but should be hidden and the products {2} are hidden visible but should be visible".With one step per product, there is the elegant solution that each failed step appears red at the first time, and we do not need to construct a unique exception message aggregating all failed steps (here, all failed product visibilities).
That solve one of my use cases, but the problem remains for other use cases where, for instance, a lot of pages need to be accessed on the same scenario without being able to break it into several scenarios.For instance, on an e-commerce website, adding a product to cart, going to the checkout process, and paying: we cannot break this scenario into 3 scenarios, and each one needs "optional" checks that don't impede other steps ability to succeed, but imply the scenario as a whole would fail.
@Matt WynneAbandoning the WARNING state, the annotation could rather be named @ContinueNextStepsFor(Throwable[] t)Or the exception to be thrown by step definitions could be named ContinueNextStepsException(Throwable t)
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Given a category with hidden and visible products
When I view the category
Then I should see the visible products
And I should not see the hidden products
You received this message because you are subscribed to a topic in the Google Groups "Cukes" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cukes/xTqSyR1qvSc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cukes+un...@googlegroups.com.

The Cucumber logo is the intellectual property of Cucumber Ltd, a limited company registered in Scotland, number 456793.
UK Headquarters: Cucumber Ltd, Drumsyniebeg, Lochgoilhead, Cairndow, Argyll, PA24 8AN UK.
I'm in charge of making sure Cucumber implementations in different languages converge towards similar behaviour. We should avoid adding new functionality to only one Cucumber implementation.
Aslak
@Sample
Scenario Outline: Test Cucumber Next step on failure functionality
Given I have two numbers "<Number1>" and "<Number2>"
Then Sum will be "<Sum>"
And Difference will be "<Difference>"
And Multiplication will be "<Multiply>"
Examples:
|Number1|Number2|Sum|Difference|Multiply|
|7 |3 |10 |2 |21 |
@ContinueNextStepsFor(AssertionError.class)
@Then("^Sum will be \"(.*?)\"$")
public void sum_will_be(String arg1) throws Throwable {
// Write code here that turns the phrase above into concrete actions
sum = Integer.parseInt(arg1);
if(sum!=a+b)
throw new AssertionError("Addition is incorrect");
System.out.println("Sum is correct");
}
@ContinueNextStepsFor({AssertionError.class})
@Then("^Difference will be \"(.*?)\"$")
public void difference_will_be(String arg1) throws Throwable {
// Write code here that turns the phrase above into concrete actions
diff = Integer.parseInt(arg1);
if(diff!=a-b)
throw new AssertionError("Difference is incorrect");
System.out.println("Difference is correct");
}
@ContinueNextStepsFor(Throwable.class)
@Then("^Multiplication will be \"(.*?)\"$")
public void multiplication_will_be(String arg1) throws Throwable {
// Write code here that turns the phrase above into concrete actions
mul = Integer.parseInt(arg1);
if(mul!=a*b)
throw new AssertionError("Multiplication is incorrect");
System.out.println("Multiplication is correct");
}
With the given data, I expect Multiplication should not skip (Difference step is fail),but still the step is skipped
Need help.
@Given("^Perform Action one$") public void perform_Action_one() throws Throwable { System.out.println("First Action Statment"); }
@Then("^Verify Object One$") public void verify_Object_One() throws Throwable { System.out.println("First Verification"); } @ContinueNextStepsFor({AssertionError.class,NullPointerException.class}) @Then("^Verify Object Two$") public void verify_Object_Two() throws Throwable { System.out.println("Error in Second Verification"); throw new AssertionError("Step is failed but next one will execute"); }
@Then("^Verify Object Three$") public void verify_Object_Three() throws Throwable { System.out.println("Third Verification"); }