Возникла ошибка «cucumber.runtime.CucumberException: не было найдено никаких серверных частей». - PullRequest
0 голосов
/ 13 апреля 2020

Я работаю над Selenium с настройкой Cucumber и сталкиваюсь с ошибкой при запуске файла TestRunner.

cucumber.runtime.CucumberException: Бэкендов не найдено. Убедитесь, что у вас есть серверный модуль на CLASSPATH.

POM. xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>Automation</groupId>
  <artifactId>Cucumber</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>Cucumber</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>

<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-junit</artifactId>
    <version>1.2.5</version>

</dependency>


<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>1.2.5</version>
    <scope>test</scope>
</dependency>


    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>      
    </dependency>
  </dependencies>
</project>

Я сопоставил файл функций с файлом StepDefinition, как показано ниже Функция file Функция: Функциональность входа в систему

Сценарий: Вход по умолчанию для домашней страницы. Данный пользователь находится на домашней странице. Когда пользователь входит в приложение с действительными учетными данными, затем пользователь должен войти в приложение, и целевая страница должна отображаться для пользователя

Файл StepDefinition

package stepDefenition;

import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;

import cucumber.api.java.en.Given;
import cucumber.api.java.en.When;
import cucumber.api.java.en.Then;

@RunWith(Cucumber.class)
public class StepDefenition {

    @Given("^User is on Home page$")
    public void user_is_on_home_page() throws Throwable {
        System.out.println("User is on Home Page");
    }

    @When("^User logs into application with valid credentials$")
    public void user_logs_into_application_with_valid_credentials() throws Throwable {
        System.out.println("User enters valid credentials and clicks on submit");

    }

    @Then("^User should be logged into application and landing page should be displayed to user$")
    public void user_should_be_logged_into_application_and_landing_page_should_be_displayed_to_user() throws Throwable {
         System.out.println("User logged in successfully and landing page is displayed to user  with all the details");
    }

}

Файл Test Runner:

package cucumberOption;

import org.junit.runner.RunWith;

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

@RunWith(Cucumber.class)
@CucumberOptions(
        features = "src/test/java/features",
        glue="stepDefenition")

public class TestRunner {   

}

Я использую версию:

  • Neon .3 Выпуск (4.6.3) Eclipse
  • Плагин Natural 0.7.6 для огурцов
  • Версия Maven: Apache Maven 3.6.3
  • Java Версия: java версия "1.8.0_241"

структура проекта

Project Structure

Я пытался изменить версии для java и Junit и добавление зависимостей Io.cucumber ничего не сработало.

Добавлен java 1.8 jdk в путь сборки проекта.

Я просмотрел все предыдущие темы по этому виду проблемы.

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