cucumber - 没有 maven 的 Cucumber java 项目 - 如果我有 Runner 类,如何从命令提示符运行
问题描述
我有一个跑步者课程,其中有我需要运行的标签。同样的工作完美,因为它选择了需要执行的功能
跑步者类看起来像
package test.java.cucumber.policy;
import com.github.mkolisnyk.cucumber.runner.ExtendedCucumber;
import com.github.mkolisnyk.cucumber.runner.ExtendedCucumberOptions;
import cucumber.api.CucumberOptions;
import cucumber.runtime.ClassFinder;
import cucumber.runtime.RuntimeOptions;
import cucumber.runtime.io.MultiLoader;
import cucumber.runtime.io.ResourceLoader;
import cucumber.runtime.io.ResourceLoaderClassFinder;
import gherkin.Main;
import org.junit.runner.RunWith;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@RunWith(ExtendedCucumber.class)
@ExtendedCucumberOptions(
retryCount = 0)
@CucumberOptions(glue = {"test.java.steps"},
features = {"src/test/resources/features/policy/shakedown"},
tags = {"@test"}
)
public class ShakedownRunner {
}
当我尝试从命令提示符运行相同的命令时,我收到未找到步骤定义错误消息。
我正在使用以下命令从命令提示符执行
java -cp "extlib/*;." cucumber.api.cli.Main -p pretty -g C:\21stNov\src\test\java\steps\common\BrowserSteps.java C:\21stNov\src\test\resources\features\policy\shakedown\test.feature
On executing i am getting that the step definitions are missing. Can somebody look into this and provide his valuable comments
#Shakedown Test 1
@Shakedown @Shakedown1 @rajat
Scenario: SHD_001_1-Portal SE Quote to GW and check quote documents ←[90m# C:/21stNov/src/test/resources/features/policy/shakedown/test.feature:6←[0m
←[33mGiven ←[0m←[33mI start the web browser←[0m
1 Scenarios (←[33m1 undefined←[0m)
1 Steps (←[33m1 undefined←[0m)
0m0.000s
You can implement missing steps with the snippets below:
@Given("^I start the web browser$")
public void i_start_the_web_browser() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
提前致谢..!
解决方案
这个问题可能与这个问题重复: 如何从命令行运行黄瓜文件
根据答案,您可以cucumber-jvm
在命令行上运行它,如下所示:
java -cp <classpath> cucumber.api.cli.Main \
--glue com.example.test \
--plugin pretty path/to/features
推荐阅读
- python - 熊猫绘图时间序列无法在 x 轴上显示时间
- javascript - Object.assign() 忽略未定义或空值
- python - Python 将枚举作为构造函数参数传递
- server - 为什么我不能在手机浏览器上输入网址来查看我的实时网站?
- angular5 - Angular - 动态标题
- javascript - React-Final-Form中如何监听Field组件的onChange?
- jquery - 如何在页面加载时保持界面视图?
- python - ValueError:无法将大小为 6744500 的数组重塑为形状 (574,1,64,47)
- react-native - React-Native 使用 Flatlist 滚动到顶部
- react-native - 按钮组件上的 setNativeProps