Can i create Cucumber dependencies in Gradle project
Answered
I have created a Gradle project in Intellij and trying to implement cucumber.
I have created features file but when i have created definition file it gives error as given below:
public class GetTokenDef {
@cucumber.api.java.en.Given("^a request with all mandatory parameters$")
public void aRequestWithAllMandatoryParameters() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new cucumber.api.PendingException();
}
}
Error: Cannot resolve symbol Cucumber (Error in Line 2 - @Cucumber..)
Can you please help me to resolve the error.
Please sign in to leave a comment.
I have a java Gradle project in Intellij and trying to implement cucumber.
I have created .feature file as given below
Feature: Validation of something
Scenario: Requests for something
Given a request with something
When something happen
Then returning something
Tried to create definition file but got below error:
public class GetTokenDef {
@cucumber.api.java.en.Given("^a a request with something$")
public void aRequestWithAllMandatoryParameters() throws Throwable {
throw new cucumber.api.PendingException();
}
}
Giving Error in line # 2 - "Cannot resolve symbol cucumber"
I think the way to resolve the issue is:
1. Adding cucumber reference - By default in Intlellij cucumber plugin is already added. Not sure how to add reference.
please help me to fix this issue
Thanks in advance.
Hello,
Have you added cucumber dependency to your build.gradle file? Please check this example project: https://github.com/cucumber/cucumber-jvm/tree/master/examples/java-gradle
Thanks