我们如何通过批处理文件 运行 黄瓜测试?

How can we run cucumber tests via a batch file?

我想 运行 我的 Cucumber 功能使用可执行的批处理文件,但我不知道该怎么做。

我的批处理文件必须允许我 运行 有选择地测试用例,即基于标签或一般任何特定功能文件。

好吧,这里是您的起点: 在您的终端中:

gedit myscript.sh

在脚本中写下以下内容:

echo "starting script"
cd /yourproject/homefolder
mvn test -Dcucumber.options=”–tags @”
echo "ending script"

保存脚本,然后在终端中输入

使其可执行
chmod +x myscript.sh

然后这样称呼它

./myscript.sh Smoke

上面的命令使用标签 Smoke 运行所有场景。

这完全是我的想法,没有测试,但应该可以! myscript.bat 的相同程序 创建 myscript.bat 并在其中写入以下内容:

echo "starting script"
cd C://yourproject/homefolder
mvn test -Dcucumber.options=”–tags @”
echo "ending script"

然后这样称呼它

myscript.bat Smoke