[英]How To Run Multiple File Feature Automation Testing Using Behave On The Command Terminal
For an example, I have created some feature for automation testing using Behave login_account.feature
and choose_product.feature
.例如,我使用 Behave
login_account.feature
和choose_product.feature
创建了一些用于自动化测试的功能。 To run on a single feature, I use this command on the terminal behave -f behave_html_formatter:HTMLFormatter -i login_account.feature
.要在单个功能上运行,我在终端上使用此命令
behave -f behave_html_formatter:HTMLFormatter -i login_account.feature
。
I want to run on multiple feature login_account.feature
and choose_product.feature
in one command on the terminal.我想在终端上的一个命令中运行多个功能
login_account.feature
和choose_product.feature
。 Anyone, can you give me the example command to run multiple feature using Behave in one command on the terminal?任何人,你能给我一个示例命令,以在终端上的一个命令中使用 Behave 运行多个功能吗? Thank you in advance.
先感谢您。
I think there might be two issues:我觉得可能有两个问题:
I'm not sure if that's the way to run with that formatter.我不确定这是否是使用该格式化程序运行的方式。 See behave-html-formatter docs for config and example.
有关配置和示例,请参阅behavior-html-formatter 文档。 I can't trial myself as I don't want/need this formatter installed.
我不想/不需要安装此格式化程序,因此无法自行试用。 I would suggest you worry about this after you understand how to run multiple features, which is where issue #2 comes in.
我建议您在了解如何运行多个功能后担心这一点,这就是问题 #2 的来源。
-i
expects a single argument, which is a regular expression pattern. -i
需要一个参数,这是一个正则表达式模式。 Assuming you are in your features
folder, just list the two features with space separator after the behave
command:假设您在
features
文件夹中,只需在behave
命令后列出两个带有空格分隔符的功能:
behave login_account.feature choose_product.feature
Better still, you could use tags.更好的是,您可以使用标签。 This makes way more sense if you want to run more than the two files in your example.
如果您要运行的不仅仅是示例中的两个文件,这将更有意义。 Add a tag at the top of each of the feature files you want to execute eg
@runme
.在您要执行的每个功能文件的顶部添加一个标签,例如
@runme
。
Then execute only the ones having the preferred tag:然后只执行具有首选标签的那些:
behave -t @runme
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.