I'm new to cucumber and after trying various not fully working tutorials, I try to make this example work: https://github.com/cucumber/cucumber-java-skeleton
My version of Eclipse (wrapped into STS 4.17.1):
To import it, I do "Import Existing maven project" on the maven project:
What works: After completing the 2 missing steps, when I run the.feature through eclipse cucumber plugin (Run as "Cucumber feature") or through "mvn test", I get:
Scenario: a few cukes # src/test/resources/io/cucumber/skeleton/belly.feature:3
Given I have 42 cukes in my belly # io.cucumber.skeleton.StepDefinitions.I_have_cukes_in_my_belly(int)
When I wait 1 hour # io.cucumber.skeleton.StepDefinitions.i_wait_hour(java.lang.Integer)
growl !
Then my belly should growl # io.cucumber.skeleton.StepDefinitions.my_belly_should_growl()
1 Scenarios (1 passed)
3 Steps (3 passed)
0m1,134s
What doesn't work (related to the eclipse cucumber plugin?), 3. and 4. are the main issues:
In Eclipse, output starts with:
janv. 31, 2023 3:23:38 PM cucumber.api.cli.Main run WARNING: You are using deprecated Main class. Please use io.cucumber.core.cli.Main
This may or may not be important for the following not working items.
1b. "growl:" is displayed BEFORE the step where it is implemented :
@Then("my belly should growl")
public void my_belly_should_growl() {
System.out.println("growl !");
}
┌───────────────────────────────────────────────────────────────────────────────────┐
│ Share your Cucumber Report with your team at https://reports.cucumber.io │
│ Activate publishing with one of the following: │
│ │
│ src/test/resources/cucumber.properties: cucumber.publish.enabled=true │
│ src/test/resources/junit-platform.properties: cucumber.publish.enabled=true │
│ Environment variable: CUCUMBER_PUBLISH_ENABLED=true │
│ JUnit: @CucumberOptions(publish = true) │
│ │
│ More information at https://cucumber.io/docs/cucumber/environment-variables/ │
│ │
│ Disable this message with one of the following: │
│ │
│ src/test/resources/cucumber.properties: cucumber.publish.quiet=true │
│ src/test/resources/junit-platform.properties: cucumber.publish.quiet=true │
└───────────────────────────────────────────────────────────────────────────────────┘
org.junit.platform.suite.engine.NoTestsDiscoveredException: Suite [io.cucumber.skeleton.RunCucumberTest] did not discover any tests
I'd like to see the cucumber tests like this in Eclipse:
Please help me make Cucumber work in Eclipse or at least generate an html cucumber report in target.
what I can say you regarding your q:
1b. I do not see in the repo you provided this example, so it is hard to say what is wrong here, I am assuming you have an extra repo with updated skeleton, so you may provide more details
have you checked this thread? quite props
What I know about Cucumber reports, you need in your Runner class, you set a path to your json cucumber report:
@CucumberOptions( features = "src/test/resources/functionalTests", glue= {"stepDefinitions"}, plugin = { "pretty", "json:target/cucumber-reports/Cucumber.json" }, monochrome = true )
More examples are here: cucumber reports
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.