如何在行为命令中给出要执行的功能文件列表

问题描述

我在features文件夹中有多个文件夹,并且我只想从驻留在这些多个文件夹中的文件中运行特定的功能文件。 因此,假设features文件夹中有10个文件 features> folder1 中有5个文件 features> folder2 中有5个文件。我要执行Folder1的2个功能文件和Folder2的2个功能文件

我有一个特征文件名。有什么方法可以通过行为命令传递它吗?

我经历了configuration parameters,但是没有运气。

解决方法

您可以从父目录传递到功能文件的路径

behave  .\features\tutorial.feature

结果:

 PS C:\Arpan Saini\Automation-Projects\python\PythonBehaveBDD> behave  .\features\tutorial.feature
@regression
Feature: showing off behave # features/tutorial.feature:2

  @slow
  Scenario: run a slow test          # features/tutorial.feature:5
    Given we have behave installed   # features/steps/tutorial.py:3
    When we implement a test         # features/steps/tutorial.py:7
    Then behave will test it for us! # features/steps/tutorial.py:11

  @wip
  Scenario: run a wip test           # features/tutorial.feature:11
    Given we have behave installed   # features/steps/tutorial.py:3
    When we implement a test         # features/steps/tutorial.py:7
    Then behave will test it for us! # features/steps/tutorial.py:11

  @wip @slow
  Scenario: run a wip and slow test  # features/tutorial.feature:17
    Given we have behave installed   # features/steps/tutorial.py:3
    When we implement a test         # features/steps/tutorial.py:7
    Then behave will test it for us! # features/steps/tutorial.py:11

1 feature passed,0 failed,0 skipped
3 scenarios passed,0 skipped
9 steps passed,0 skipped,0 undefined
Took 0m0.006s
PS C:\Arpan Saini\Automation-Projects\python\PythonBehaveBDD>

有关更多详细信息,请阅读以下文档

https://behave.readthedocs.io/en/latest/tutorial.html#controlling-things-with-tags

我有一个未解决的问题,与标签无关

Even though have installed "cucumber-tag-expressions 3.0.0" the behave command with "and" and "or" operator are not working