Python 在behave framework中使用自定义标记运行场景
如何使用自定义标记选择要运行的场景 对于Eaxmple,以下是功能文件Python 在behave framework中使用自定义标记运行场景,python,bdd,python-behave,Python,Bdd,Python Behave,如何使用自定义标记选择要运行的场景 对于Eaxmple,以下是功能文件 Feature:my example feature @Test_Name:sample @abc:1234 @sd:567 Scenario: Example scenario Given my Name is sample When my Name is whensample Then my Name is endsample 我有多个功能文件,每个功能文件都有许多场景。场景标记与上面提到的方式类似。 我
Feature:my example feature
@Test_Name:sample @abc:1234 @sd:567
Scenario: Example scenario
Given my Name is sample
When my Name is whensample
Then my Name is endsample
我有多个功能文件,每个功能文件都有许多场景。场景标记与上面提到的方式类似。
我正在尝试运行该场景
behave -t Test_Name --> to run all files
behave -t abcd --> run specific scenario
behave -t 1234 --> run specific scenario
请建议是否有任何方法可以做到这一点。向@testtag1、@testtag2等场景添加标记,如下所示
Feature: showing off behave
@testtag1
Scenario: run a simple test
Given we have behave installed
when we implement a test
then behave will test it for us!
@testtag2
Scenario: run a simple test2
Given we have behave installed
when we implement a test
then behave will test it for us!
@testtag1
Scenario: run a simple test3
Given we have behave installed
when we implement a test
then behave will test it for us!
运行命令
behave --tags=testtag1
测试标签为testtag1的场景,由Surbhi于2020年7月9日创建
功能:#在此处输入功能名称
@chrome
脚本:
给定用户在带有chrome的python上测试selenium
@ff
情景:
给定用户在使用firefox的python上测试selenium UseCommand:
参数配置中的behave-t=chrome和behave-t=ff 或者也可以使用:behave--tags=@chrome