【问题标题】:How to fix "Test Class not found in selected project" in cucumber junit如何修复黄瓜junit中的“在选定项目中找不到测试类”
【发布时间】:2019-07-24 17:37:44
【问题描述】:

我是 Cucumber 的新手。我创建了一个简单的黄瓜脚本来在浏览器中启动谷歌。我正确地创建了功能、步骤和运行器类。当我运行 runner 类时,junit 结果显示为绿色,但场景未执行(浏览器未启动)。检查结果并尝试双击时,它显示“在所选项目中找不到测试类”。

我已经尝试在 Build path->Order&Export 选项中更改 JRE 的顺序。这是 Eclipse。JUnit result image

这是跑步者类:

package Runners;

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(features="Features/ChromeTest.feature",glue= {"src/test/java/Steps"})
public class ChromeRunner {

}

【问题讨论】:

标签: eclipse selenium junit cucumber-junit


【解决方案1】:

我假设您将功能文件也保存在 src/test/java 路径中

如果是这样,请尝试运行

@CucumberOptions(features="src/test/java/features",glue="steps")

@CucumberOptions(features="src/test/java/features",glue="src/test/java/steps")

**假设您已经在 src/test/java 路径中创建了功能和步骤作为包

【讨论】:

  • 感谢您的回复。但我的功能文件夹是外部 src 文件夹。所以我希望文件夹结构没有问题。有什么可以检查依赖项(它是一个行家)。请澄清
  • 你可以尝试使用下面的框架github.com/toolsqa/CucumberFramework
猜你喜欢
  • 1970-01-01
  • 2021-07-20
  • 1970-01-01
  • 2019-03-19
  • 1970-01-01
  • 2018-12-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多