相关疑难解决方法(0)

在junit中运行黄瓜时出错

嗨,我是黄瓜java新手.我正在尝试运行简单的黄瓜功能测试.下面是我的功能文件,步骤定义文件和junit runner文件.但我无法在cucumber-java,cucumber-junit 1.1.6版本中成功运行测试.

功能文件

Feature: Test if f1 feature is working
Scenario: valid scenario
Given input1 is "t"
When input2 is also "t"
Then result should be "pass"
Run Code Online (Sandbox Code Playgroud)

Stepdefinition文件

package cucumberFrameworkPractise;

import org.junit.Assert;

import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;



public class CucumberStepDefinitionTest {
    String input1,input2,result;
@Given("input1 is \"([^\"]*)\"$")
public void input1(String input1)
{
    this.input1=input1;
}
@When("input2 is also \"([^\"]*)\"$")
public void input2(String input2)
{
    this.input2=input2;
}
@Then("result should be \"([^\"]*)\"$")
public void result(String result)
{
    this.result=result;
    Assert.fail();
}
}
Run Code Online (Sandbox Code Playgroud)

黄瓜亚军文件 …

java cucumber cucumber-junit

4
推荐指数
2
解决办法
3万
查看次数

标签 统计

cucumber ×1

cucumber-junit ×1

java ×1