黄瓜特征文件不识别步骤

2022-01-22 00:00:00 selenium gherkin cucumber java eclipse

我已经编写了我的耐寒黄瓜功能文件.当我将功能文件作为 Cucumber Feature 运行时,出现以下错误

I have written my firsy cucumber feature file. When I run the feature file as Cucumber Feature, I get below errors

  1. 警告:Cucumber-JVM 的 --format 选项已弃用.请改用 --plugin."- 我在跑步者类的@CucumberOptions 中使用了插件",但仍然遇到同样的错误

2.它说我没有任何场景和步骤功能:验证模块化 GUI 页面

2.It says I do not have any scenario and steps Feature: Validate Modular GUI pages

场景:验证登录页面#C:/Selenium/RegressionTest/ModularRegression/src/GUI/features/Validate.feature:3给定:模块化 GUI 已打开何时:验证登录页面然后:登录到模块化

Scenario: Validate Login Page # C:/Selenium/RegressionTest/ModularRegression/src/GUI/features/Validate.feature:3 Given: Modular GUI is opened When: Validate the login page Then: Login to the Modular

0 场景0 步

  1. 我没有收到我的步骤的片段.

我已将以下 jar 添加到库中罐子

I have added following jars to the library Jars

这是我的跑步课,包图形界面;

This is my runner class, package GUI;

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(
        format = {"pretty", "json:target/"},
        features = {"src/GUI/"}
        )
public class GUIRunner {

}

这是我的功能文件,

Feature: Validate Modular GUI pages

  Scenario: Validate Login Page
    Given: Modular GUI is opened
    When: Validate the login page
    Then: Login to the Modular

如果有人能指出我的代码中缺少的内容,我将不胜感激.

I would really appreciate if someone can point out what is missing in my code.

非常感谢

[已编辑]这是实际的错误:

This is the actual error:

警告:Cucumber-JVM 的 --format 选项已弃用.请用--plugin 代替.功能:验证模块化 GUI 页面

WARNING: Cucumber-JVM's --format option is deprecated. Please use --plugin instead. Feature: Validate Modular GUI pages

场景:验证登录页面#C:/Selenium/RegressionTest/ModularRegression/src/GUI/features/Validate.feature:3给定:模块化 GUI 已打开时间:验证登录页面然后:登录到模块化

Scenario: Validate Login Page # C:/Selenium/RegressionTest/ModularRegression/src/GUI/features/Validate.feature:3 Given: Modular GUI is opened When: Validate the login page Then: Login to the Modular

0 场景 0 步 0m0.000s

0 Scenarios 0 Steps 0m0.000s

推荐答案

在 Given、When 和 Then 之后,我的功能文件中多了一个:".

I had an extra ":" in my feature file after Given, When and Then.

现在可以了.

相关文章