Не найдено определений для файла функций - PullRequest
1 голос
/ 26 мая 2020

Я новичок в селеновом огурце. Я получаю сообщение об ошибке в файле функций «не найдено определений ..». Но я написал определения. Я также могу отлично провести тесты на огурцы.

Характеристика:

Feature: LOGIN_FEATURE
Scenario: login scenario

Given User is already on login page
When title is crom
Then user enters un and pw

Определение шага:

    package stepDefinition;

import io.cucumber.java.en.And;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import junit.framework.Assert;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import static org.junit.Assert.*;
//import org.junit.Assert;
import static org.testng.Assert.assertTrue;

//import cucumber.api.java.en.Given;

public class loginStepDef {

    WebDriver driver;
    //@Then"^login should be unsuccessful$" 

    @Given ("^User is already on login page$")
    public void User_already_on_login_page(){
        System.out.println("givenM method started");
        System.setProperty("webdriver.chrome.driver","C:\\src\\main\\resources\\chromedriver.exe");
        driver = new ChromeDriver();
        driver.get("https://web.bettylist.com/user");
        System.out.println("---Navigated to the URL.");

    }

    //@SuppressWarnings("deprecation")
    @When("^title is crom$")
    public void title_is_crom(){
        System.out.println("whenM started.");
        String title = driver.getTitle();
        System.out.println("title" + title);
        //Assert.assertEquals("Ff", title);
        assertEquals("Log in | bettylist", title);
        System.out.println("---validated the title before logging in.");
    }

Бегун:

    package MyRunner;

import org.junit.runner.RunWith;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
//import cucumber.junit.Cucumber; 

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


@RunWith(Cucumber.class)
@CucumberOptions(
        features = "workspace/Cucumber3/src/main/java/Features",
        glue="stepDefinition"
        //format = {"pretty", "html:target/Destination"} 
        //plugin = {"pretty","html:test-outout"},
        //plugin = {"json:Folder_Name1/cucumber.json"},
        //plugin = {"junit:Folder_Name/cucumber.xml"},
        //dryRun = false
        //monochrome = false,
        //strict = false
      )
public class TestRunner {

}

enter image description here

Я использую среду ecliipse IDE. Я также установил плагин Natural. Как я могу исправить отсутствие определений в файле функций?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...