My Story file:
**Given** a calculator
**When** I add 2 and 9
**Then** the outcome should 11
My Java Class:
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.When;
import org.jbehave.core.annotations.Then;
import org.testng.Assert;
import org.testng.annotations.Test;
@Test
public class debugPluginSteps {
private Calculator myCal;
@Given("a calculator")
public void setCal() {
myCal=new Calculator();
System.out.println("Created");
}
@When("I add $number1 and $number2")
public void AddCal(int x,int y) {
myCal.addTwoNumber(x, y);
}
@Then("the outcome should $result")
public void testResult(int output) {
Assert.assertEquals(output, myCal.getresult());
//System.out.println("Result : " + output);
}
Another java class in which I have written another method to sum two integer values:
public class Calculator {
private int sum;
public Calculator() {
this.sum = 0;
}
public void addTwoNumber(int x, int y) {
sum = x + y;
}
public int getresult() {
return this.sum;
}
I have also included TestNG, Jbehave and gherkins(jar) file in my build path. I am not getting option to run as testNG. Also, I have created testNG.xml file. So my first question is how to interlink story file and feature file with testNG and second thing how to run it using testNG