[INFO] Project created from Archetype indir: <directory where you created the project>/cucumber [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------
Scenario: Sunday isn't Friday # src/test/resources/features/is_it_friday_yet.feature:4 Given today is Sunday When I ask whether it's Friday yet Then I should be told "Nope" [ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.142 s <<< FAILURE! -- in hellocucumber.RunCucumberTest [ERROR] Is it Friday yet?.Sunday isn't Friday -- Time elapsed: 0.024 s <<< ERROR! io.cucumber.junit.platform.engine.UndefinedStepException: The step 'today is Sunday' and 2 other step(s) are undefined. You can implement these steps using the snippet(s) below:
@Given("today is Sunday") public void today_is_sunday() { // Write code here that turns the phrase above into concrete actions throw new io.cucumber.java.PendingException(); } @When("I ask whether it's Friday yet") public void i_ask_whether_it_s_friday_yet() { // Write code here that turns the phrase above into concrete actions throw new io.cucumber.java.PendingException(); } @Then("I should be told {string}") public void i_should_be_told(String string) { // Write code here that turns the phrase above into concrete actions throw new io.cucumber.java.PendingException(); }
at io.cucumber.core.runtime.TestCaseResultObserver.assertTestCasePassed(TestCaseResultObserver.java:69) at io.cucumber.junit.platform.engine.TestCaseResultObserver.assertTestCasePassed(TestCaseResultObserver.java:22) at io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.lambda$runTestCase$4(CucumberEngineExecutionContext.java:114) at io.cucumber.core.runtime.CucumberExecutionContext.lambda$runTestCase$5(CucumberExecutionContext.java:137) at io.cucumber.core.runtime.RethrowingThrowableCollector.executeAndThrow(RethrowingThrowableCollector.java:23) at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:137) at io.cucumber.junit.platform.engine.CucumberEngineExecutionContext.runTestCase(CucumberEngineExecutionContext.java:109) at io.cucumber.junit.platform.engine.NodeDescriptor$PickleDescriptor.execute(NodeDescriptor.java:168) at io.cucumber.junit.platform.engine.NodeDescriptor$PickleDescriptor.execute(NodeDescriptor.java:90) at java.util.ArrayList.forEach(ArrayList.java:1259) at java.util.ArrayList.forEach(ArrayList.java:1259)
[INFO] [INFO] Results: [INFO] [ERROR] Errors: [ERROR] The step 'today is Sunday' and 2 other step(s) are undefined. You can implement these steps using the snippet(s) below:
@Given("today is Sunday") public void today_is_sunday() { // Write code here that turns the phrase above into concrete actions throw new io.cucumber.java.PendingException(); } @When("I ask whether it's Friday yet") public void i_ask_whether_it_s_friday_yet() { // Write code here that turns the phrase above into concrete actions throw new io.cucumber.java.PendingException(); } @Then("I should be told {string}") public void i_should_be_told(String string) { // Write code here that turns the phrase above into concrete actions throw new io.cucumber.java.PendingException(); }
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.107 s <<< FAILURE! -- in hellocucumber.RunCucumberTest [ERROR] Is it Friday yet?.Sunday isn't Friday -- Time elapsed: 0.007 s <<< ERROR! io.cucumber.java.PendingException: TODO: implement me at hellocucumber.stepdefs.common.Friday.today_is_sunday(Friday.java:9)
@Then("I should be told {string}") publicvoidi_should_be_told(String expectedAnswer) { assertEquals(expectedAnswer, actualAnswer); } }
再次运行Cucumber:
1 2 3 4
[ERROR] Is it Friday yet?.Sunday isn't Friday -- Time elapsed: 0.009 s <<< FAILURE! org.opentest4j.AssertionFailedError: expected: <Nope> but was: <null> at com.shinyruo.hellocucumber.stepdefs.common.Friday.i_should_be_told(Friday.java:26) at ?.I should be told "Nope"
Scenario: The example # src/test/resources/features/example.feature:3 Given an example scenario # com.shinyruo.hellocucumber.stepdefs.common.StepDefinitions.anExampleScenario() When all step definitions are implemented # com.shinyruo.hellocucumber.stepdefs.common.StepDefinitions.allStepDefinitionsAreImplemented() Then the scenario passes # com.shinyruo.hellocucumber.stepdefs.common.StepDefinitions.theScenarioPasses()
Scenario: Sunday isn't Friday # src/test/resources/features/is_it_friday_yet.feature:4 Given today is Sunday # com.shinyruo.hellocucumber.stepdefs.common.Friday.today_is_Sunday() When I ask whether it's Friday yet # com.shinyruo.hellocucumber.stepdefs.common.Friday.i_ask_whether_it_s_Friday_yet() Then I should be told "Nope"# com.shinyruo.hellocucumber.stepdefs.common.Friday.i_should_be_told(java.lang.String) [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.100 s -- in com.shinyruo.hellocucumber.RunCucumberTest [INFO] [INFO] Results: [INFO] [INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------