如何在 cypress cucumber 中运行选定的功能文件/场景并跳过其他文件/场景

apu*_*pun 9 cucumber cypress

我尝试了几个命令,但似乎没有任何效果。它要么逃脱所有,要么不运行。

@TestFeature
Feature: Test Feature

    Testing sample feature

    Background: Logging in
    @manual
    Scenario: A
        Given
    Scenario Outline: B
Run Code Online (Sandbox Code Playgroud)

我想运行Test Feature并跳过标记的场景manual。我试过 -

npx cypress run --env TAGS=@TestFeature and not @manual --browser chrome
Run Code Online (Sandbox Code Playgroud)

但这不起作用。也尝试过类似的组合,但没有效果。

小智 5

您可以使用CLI 选项--spec(简称:)-s运行特定的测试文件或功能,例如:

npx cypress run --spec cypress/integration/TestCases/Testsite.feature --env \"TAGS=@smoke\" --browser chrome",
Run Code Online (Sandbox Code Playgroud)


Mr.*_* J. 0

据我所知,目前不可能使用标签运行测试。您可以在 github ( https://github.com/cypress-io/cypress/issues )中为此创建一个问题,让他们实现它。

作为解决方案,我们选择创建冒烟测试和功能测试。烟雾测试位于单独的目录中,这使我们能够仅运行这些测试场景而不是整个测试套件。您可以通过使用以下命令运行测试来做到这一点: npx cypress run --spec /cypress/smoketest/*