[英]How do I execute 1 specific feature file using behave command in Python?
I am working on a Selenium Python project where I need to run test cases to share insights to my team members.我正在开发一个 Selenium Python 项目,我需要运行测试用例以与我的团队成员分享见解。 The issue is that I want to use this command:
问题是我想使用这个命令:
behave -f allure_behave.formatter:AllureFormatter -o allure/results ./features
to execute 1 specific feature file like the one below:执行 1 个特定功能文件,如下所示:
createrequest.feature createrequest.feature
Feature: Creation of top up requests
Background: Access to EZ-Link's Utility Top Up Menu
Given the user access EZ-Link's Portal
When he enter login information
Then he should be able to login to Utility Top Up navigation menu
Scenario: Create top up request for new card
Given the user click on create top up (new card) request navigation menu
When he enter job order number and top up amount in the request page
And check the total top-up amount
Then the successful submission response is displayed once request is submitted for new card
And status should display "Pending" once he key in the new card job order number in the View Top Up Request page
Scenario: Create top up request for existing card
Given the user click on create top up (existing card) request navigation menu
When he enter job order number in the request page
And check the total topup amount
Then the successful submission response is displayed once request is submitted for existing card
And status should display "Pending" once he key in the existing card job order number in the View Top Up Request page>
May I know how to run this specific feature file using the aforementioned behave
command in Pycharm?我可以知道如何在 Pycharm 中使用上述
behave
命令运行此特定功能文件吗?
I have already figured out the solution.我已经想出了解决办法。 If you want to run a specific feature file using
allure
command, you can try this:如果你想使用
allure
命令运行特定的功能文件,你可以试试这个:
behave -f allure_behave.formatter:AllureFormatter -o allure/results ./features/createrequest.feature
For my case, the feature file I wanna run is createrequest.feature
thus I just add it in the command.就我而言,我要运行的功能文件是
createrequest.feature
,因此我只需将其添加到命令中。 Before the command is being used, please create directory for your allure
report.在使用该命令之前,请为您的
allure
报告创建目录。 Make sure your directory is like this:确保你的目录是这样的:
Project name
|
|---allure
| |---results(sub-directory of allure folder)
| |---reports(sub-directory of allure folder)
|
|---features
| |
| |---steps(sub-directory of features folder)
| |
| feature files
This is what I believe the recommended practice for creating directories akin to Python
BDD
using behave
.这就是我认为推荐的使用
behave
创建类似于Python
BDD
的目录的做法。 Hope this answers your question.希望这能回答你的问题。
For more info: How to Allure-behave generate report from test cases.欲了解更多信息: 如何从测试用例中引诱行为生成报告。 Allure generated only one report from one test case
Allure 仅从一个测试用例生成一份报告
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.