检查这些选项
选项1: 确保您运行的代码,黄瓜功能并用黄瓜插件
在你的情况帮助产生的骨架,黄瓜将打印像这样
//Print start
@Given("^user is on Homepage$")
public void user_is_on_Homepage() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@When("^user enters Username and Password$")
public void user_enters_Username_and_Password() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
@Then("^He can visit the practice page$")
public void he_can_visit_the_practice_page() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
//Print End
创建程序包features.stepDefinitions然后creat具有上述生成的骨架的e类文件“ABC.java”。请继续选项2
选项2
如果下面的类是亚军,我们需要具有以下特征:文件夹的胶水。通常它会在资源文件夹
package test.runner
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
@CucumberOptions(
features="src/test/resources/features/featureFileFolder",
glue = { "features.stepDefinitions"},
tags={"@UI"},
monochrome=true)
public class Runner{
}
最后执行亚军文件作为JUnit测试
注:
标签UI是我们将使用链接的场景和注释。
在这种情况下,功能文件将写为。
@UI
情景:成功登录使用有效凭据
鉴于用户在首页
当用户输入用户名和密码
那么他就可以访问该页面的做法
希望这可以帮助!
请分享您的文件格式和跑步者等级。您遇到的问题可能有很多不同的原因,我们没有足够的信息来帮助您。 –