运行黄瓜特定功能文件或文件夹的Maven [英] Maven running cucumber specific feature files or folders

查看:64
本文介绍了运行黄瓜特定功能文件或文件夹的Maven的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从maven 命令行使用黄瓜功能选项.
在充满功能(测试)的树中,我试图仅运行单个功能.就我而言-所选文件夹中的所有功能文件.

How is it possible to use the cucumber feature option from maven command line.
Of a tree full of features (tests), I'm trying to run only individual features. In my case - all feature files in a selected folder.

我尝试使用以下语法:

mvn install -Dcucumber.options="classpath:com/company/regression/features/administration/"

它运行所有测试.没有错误,也没有评论.
我尝试了其他几种选择,但都没有效果!

It runs all tests. No errors and no comments.
I tried several other options and none worked!

这里的任何帮助将不胜感激.

Any help here will be greatly appreciated.

推荐答案

我更改了方法,并决定改用标签.
现在,我运行一个命令,告诉我要使用哪些标签,并确保在功能文件的开头放置一个特殊标签.
我的命令现在看起来像:

I changed my approach, and decided to use tags instead.
Now, I run a command that tells me which tags to use and I make sure to put a special tag at the beginning of the feature file.
My command now looks like:

mvn install -Dcucumber.options="--tags @runThis --tags ~@ignore --format json-pretty:target/cucumber-report-myReport.json --format html:target/cucumber-html-report-myReport"

我放置的标签是 @runThis ,而〜@ ignore 是告诉黄瓜运行 @ignore 标签.
我还为每次运行创建了一个不同的报告,因此Jenkins黄瓜插件可以从所有不同的运行中创建一个报告,而且它们不会互相覆盖.

The tag I put is @runThis and the ~@ignore is to tell cucumber not to run the @ignore tags.
I also create a different report for each run, so Jenkins cucumber plugin can create a single report from all the different runs and they don't overwrite each other.

我希望这会有所帮助.

这篇关于运行黄瓜特定功能文件或文件夹的Maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆