0

假设,我在 1 个功能文件GamePlay.feature下有许多场景。

Feature: Game play

@TestCase_1 @Regression
 Scenario: Breaker joins a game
    Given the Maker has started a game with the word "silky"
    When the Breaker joins the Maker's game
    Then the Breaker must guess a word with 5 characters

@TestCase_2 @Regression 
 Scenario: Breaker joins a game
    Given the Maker has started a game with the word "soft"
    When the Breaker joins the Maker's game
    Then the Breaker must guess a word with 4 characters

.
.
. and many more

假设我想复制测试用例 #2(Scenario, Given, When, Then)的测试步骤并将它们粘贴到新的功能文件(GameLost.feature)中。我将根据标签搜索场景(例如 -@TestCase_2)新的功能文件GameLost.feature应该如下所示 -

Feature: Game lost

@TestCase_2 @Regression 
 Scenario: Breaker joins a game
    Given the Maker has started a game with the word "soft"
    When the Breaker joins the Maker's game
    Then the Breaker must guess a word with 4 characters

我怎样才能在 Java 中做到这一点?

4

1 回答 1

0

可能你可以利用bdd 生成器qaf-cucumber。您应该使用元数据过滤器在空运行模式下运行,并且生成的文件将仅包含那些元数据(标签)的场景。BDD 生成器从您在或文件中编写.bdd的测试生成功能文件。如果需要,您可以创建与BDDGenerator相同的自定义实现。.feature.java

于 2020-12-04T18:51:33.213 回答