Java 如何使用JBehave运行TestNG

Java 如何使用JBehave运行TestNG,java,junit,testng,jbehave,testng-eclipse,Java,Junit,Testng,Jbehave,Testng Eclipse,我的故事文件: **Given** a calculator **When** I add 2 and 9 **Then** the outcome should 11 我的Java类: import org.jbehave.core.annotations.Given; import org.jbehave.core.annotations.When; import org.jbehave.core.annotations.Then; import org.testng.Assert; im

我的故事文件:

**Given** a calculator
**When** I add 2 and 9
**Then** the outcome should 11
我的Java类:

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);
}
另一个java类,我在其中编写了另一个方法来求两个整数值之和:

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;
}
我还将TestNG、Jbehave和gherkins(jar)文件包含在构建路径中。 我没有选择作为testNG运行。 此外,我还创建了testNG.xml文件。
所以我的第一个问题是如何将故事文件和功能文件与testNG链接,第二个问题是如何使用testNG运行它

你有没有读过?@user3707125我已经通过FAQ,有人提到我们可以使用TestNG,但没有给出如何使用它的地方。那么这段代码呢:
class YourStory Extendes JUnitStore/Stories{@org.TestNG.annotations.Test public void run()
?使用@org.testng注释?能否提供有关上述注释的更多详细信息?我不确定应该将其包括在哪里