未应用 Cucumber 标签,所有场景均运行

问题描述 投票:0回答:1

在下面的情况下,我只想运行带有标签的场景 -

@smoke
应该运行,但是它运行所有场景。当我运行此命令时,标签未应用:

test runner class
import org.junit.runner.RunWith;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)    
@CucumberOptions(
features= {"src/test/java/myfeatures"},
glue= {"stepdefinition"},
plugin= {"pretty"},
monochrome=true,
tags= "@smoke",
dryRun=false

            )

Feature: Laptop search

@smoke
Scenario: simple data passing

Given I have a search field on the amazon page
When i search for the product "ssss" and price 555
Then product name with "sss" is displayed

Scenario: simple data passing

Given I have a search field on the amazon page
When i search for the product "a" and price 22
Then product name with "a" is displayed

Scenario: simple data passing

Given I have a search field on the amazon page
When i search for the product "b" and price 33
Then product name with "b" is displayed
cucumber
1个回答
0
投票

您正在使用 IDEA 直接运行您的功能。所以 IDEA 使用 Cucumbers CLI,而不是你的运行器类。

您可以在IDEA中编辑运行配置并添加

--tags @smoke
选项。

对于其他选项,请使用

--help
选项。

© www.soinside.com 2019 - 2024. All rights reserved.