在behavior fram中使用自定义标记运行场景

2024-09-30 18:30:20 发布

您现在位置:Python中文网/ 问答频道 /正文

如何使用自定义标记选择要运行的方案?在

对于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

我有多个要素文件,每个要素文件都有许多场景.场景标记与上面提到的方式类似。 我在试着去处理这个场景

^{pr2}$

如果有办法的话,请提出建议。在


Tags: 文件samplename标记testisexamplemy
1条回答
网友
1楼 · 发布于 2024-09-30 18:30:20

向@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!

运行命令

^{pr2}$

测试标记为testtag1的场景

相关问题 更多 >