简体   繁体   English

如何在命令终端上使用 Behave 运行多个文件功能自动化测试

[英]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.featurechoose_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.featurechoose_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:我觉得可能有两个问题:

  1. 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 的来源。

  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.

相关问题 如何在不发出长终端命令的情况下在flutter中使用一个配置文件运行多个测试文件? - How to run multiple testing files with one config file in flutter without making long terminal command? 如何使用Java Selenium自动化测试选择多行? - How to select multiple lines using java Selenium automation testing? 如何使用perl从命令行读取配置文件(自动化) - How to read a config file from a command line using perl (automation) 如何使用C#在Visual Studio 2017中设置自动化测试项目以及如何在TFS中运行测试脚本 - How to setup automation testing project in visual studio 2017 using C# & How to RUN the Test Scripts in TFS 无法使用.bat 文件运行 pytest 命令,但在 pytest 终端中可以使用相同的命令 - Unable to run pytest command using .bat file but same command is ok in pytest terminal 使用winium进行自动化测试 - Automation Testing using winium 使用 Robot Framework 的自动化测试中的文件上传选项 - File Upload Option in Automation Testing Using Robot Framework 多语言网站测试自动化 - Multiple languages of website testing automation SpecRun.exe:从命令行运行 .feature 或 .playlist 文件 - SpecRun.exe: run .feature or .playlist file from command line 黄瓜/自动化测试:如何使用javascript函数处理整体概念? - Cucumber/Automation testing: How to approach the overall concept using javascript functions?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM