junit - 缺少的步骤 - Junit - Cucumber
问题描述
我在我的自动化代码中使用 cucumber 和 Junit,我使用以下代码创建了一个 Runner 类:
@RunWith(Cucumber.class)
@CucumberOptions(features = "src/main/java/CompraVtex/CompraVtex/VtexCompra.feature", glue = { "Steps" }, plugin = {
"pretty", "html:target/cucumber-reports" }, monochrome = true, dryRun = false)
public class Runner {
}
在我的黄瓜功能上:
@tag1
Scenario: Acessando Portal Receba em Casa
Given acessei a url do portal
And cliquei no botao de Login com google
And Mudei o foco para a tela do Pop Up
在我的步骤课上:
public class Steps extends Execute {
@Test(priority=1)
@Given("acessei a url do portal")
public void AcessoUrl() {
Execute Executar = new Execute();
Executar.abrirBrowser();
}
@Test(priority=2)
@And("cliquei no botao de Login com google")
public void Login() throws Exception {
Execute Executar = new Execute();
getscreenshot("01 Login","01 - Acessando URL");
Executar.Login();
}
但是当我尝试使用 Junit 运行时,它会显示以下消息:
您可以使用以下代码片段实现缺少的步骤:@Given("^acessei a url do portal$")
你能帮我修一下吗?谢谢
解决方案
请尝试在文件 Cucumber Feature 中添加标签名称:
@RunWith(Cucumber.class)
@CucumberOptions(features = "src/main/java/CompraVtex/CompraVtex/VtexCompra.feature", glue = { "Steps" },tags = {"@tag1"}, plugin = {
"pretty", "html:target/cucumber-reports" }, monochrome = true, dryRun = false)
public class Runner {
}
推荐阅读
- python - python Django中的结果管理
- python - 通过 Pandas Dataframe 像 switch 语句一样广播的聪明方法
- python - Python 套接字侦听失败,错误目标机器主动拒绝它
- amazon-web-services - 模板包含错误。:模板格式错误:YAML 格式不正确
- scala - 如何在 SonarQube 中获取 Scala SBT 构建的单元测试计数
- xml - 以下 xml 请求用于从 tally 中导出 Master
- jquery - 选中一个复选框时,如何在 ACF 中创建的另一个块中隐藏其他复选框?
- java - apache-flink +spring boot - 与 spring boot 应用程序启动相关的日志未打印在 flink 1.12 的文件中
- html - 使用内联块后 DIV 下降
- ios - openssl ocsp 响应者错误:未经授权 (6)