I'm using Intellij IDEA IDE. I wrote 2 java classes and 1 feature cucumber file in project. feature structure is:
Feature: First test
with Cucumber
Scenario: Testing
Given file.xml from ext
When take project path
Then run test
Also I wrote 1 jUnit java class for RunTest with Cucumber.class:
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
import org.hamcrest.SelfDescribing;
import gherkin.util.FixJava;
import cucumber.deps.com.thoughtworks.xstream.converters.ConverterRegistry;
@RunWith(Cucumber.class)
public class RunTest {
}
And this is signature of my Test class with cucumber's given, when and then:
public class CallSoapSteps {
//variables for file and path to project
String fileXML = "";
String pathToProj = "";
//take any xml file for insert it into Insert() SoapUI step
@Given("^file.xml from ext$")
public String file_xml_from_ext()
{
//take file
return fileXML = "path_to_xml_file";
}
//any statement about our xml file
@When("^take project path$")
public String take_project_path()
{
//take path to project
return pathToProj = "path_to_soap_project";
}
//any properties for our steps and running SoapTest
@Then("^run test$")
public void run_test() throws Exception {
//add test project
WsdlProject project = new WsdlProject(take_project_path());
//add xml file for test into property
project.setPropertyValue("File", file_xml_from_ext());
//get TestSuite and TestCase by name
TestSuite testSuite = project.getTestSuiteByName("Test");
TestCase testCase = testSuite.getTestCaseByName("Test");
//run test
testCase.run(new PropertiesMap(), false);
}
}
But if I try run jUnit Test, I catched this exception:
java.lang.NoSuchMethodError: gherkin.formatter.model.Scenario.getId()Ljava/lang/String;
And I don't know in which reasons I see this exception. Also I see this before exception:
0 Scenarios
0 Steps
0m0.000s
As I know, Ljava/lang/String
cheked if I string arrays as strings. But in this code I haven't arrays.
UPDATE.
So, I find reason for this exception. Need to use gherkin 2.12.2.
In the Exception you provided above java.lang.NoSuchMethodError: gherkin.formatter.model.Scenario.getId()Ljava/lang/String;
i think you are using gherkin 2.12.0.jar which does not have getId function in the specified class
Please use gherkin 2.12.2.jar and place this jar in your project build path and try executing