Огурец BDD с бегуном JUnit и Gradle в качестве инструмента для сборки - PullRequest
0 голосов
/ 03 апреля 2020

Я получаю успешную сборку при выполнении задачи gradle mobileSuiteRunner , но для шага, такого как Hello, не напечатано, не был выполнен код. Может ли кто-нибудь помочь мне

gradle parallelMobileSuite

> Task :compileTestJava
Note: /Users/XXXX/Desktop/FW/FirstMobileApp/src/test/java/StepDefinitions/main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :parallelMobileSuite
Feature: As a user, I should initiate payment in T24

  @mobile @run
  Scenario: A user launches Chrome Browser # src/test/java/Features/ChromeBrowser.feature:4
    Given I launch the Chrome Browser      # null
    And I navigate to Home Screen          # null

Undefined scenarios:
src/test/java/Features/ChromeBrowser.feature:4 # A user launches Chrome Browser

1 Scenarios (1 undefined)
2 Steps (2 undefined)
0m0.108s


You can implement missing steps with the snippets below:

@Given("I launch the Chrome Browser")
public void i_launch_the_Chrome_Browser() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}

Given("I launch the Chrome Browser", () -> {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java8.PendingException();
});

@Given("I navigate to Home Screen")
public void i_navigate_to_Home_Screen() {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java.PendingException();
}

Given("I navigate to Home Screen", () -> {
    // Write code here that turns the phrase above into concrete actions
    throw new io.cucumber.java8.PendingException();
});



Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 2s

Это мой проект. Est──TestRunner

Файл функций publi c Класс PaymentsStepDefinition расширяет возможности LoadAllServices En {

public PaymentsStepDefinition() {
    Given("^I launch the Chrome Browser$", () -> {
        try {
            System.out.println("Hello");
            appLaunchHelper.getDevices();
            appLaunchHelper.setUpCapabilities();
            appLaunchHelper.closeApp();
            appLaunchHelper.setAppiumDriverService("stop");
        } catch (Exception e) {

        }
    });

}}

файл build.gradle & Test Runner

buildscript {
    repositories {
        mavenCentral()
    }

}

plugins {
    id 'java'
    id 'idea'
}

version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

allprojects {
    repositories {

        maven { url 'https://jitpack.io' }
    }
}

repositories {
    jcenter()
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
    testCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5'
    testCompile group: 'info.cukes', name: 'cucumber-java', version: '1.2.5'
    testCompile group: 'info.cukes', name: 'cucumber-java8', version: '1.2.5'
    compile group: 'com.testvagrant', name: 'optimus', version: '2.2.3'
    compile group: 'info.cukes', name: 'cucumber-core', version: '1.2.5'
    compile 'io.appium:java-client:3.3.0'
    compile 'com.googlecode.json-simple:json-simple:1.1.1'
    compile 'org.apache.httpcomponents:httpclient:4.5.1'
    compile 'io.github.prashant-ramcharan:courgette-jvm:4.0.1-snapshot'

}

configurations {
    cucumberRuntime {
        extendsFrom testImplementation
    }
}

task cucumber() {
    dependsOn assemble, compileTestJava
    doLast {
        javaexec {
            main = "io.cucumber.core.cli.Main"
            classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
            args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber', 'src/test/java']
        }
    }
}

task mobileSuiteRunner(type: Test) {
    include 'TestRunner.class'
    outputs.upToDateWhen { false }
}

test {
    useJUnitPlatform()
}

My Test Runner Class TestRunner. java

@RunWith(Courgette.class)
@CourgetteOptions(
        runLevel = CourgetteRunLevel.SCENARIO,
        showTestOutput = true,
        reportTargetDir = "output",
        cucumberOptions = @CucumberOptions(
                features = "src/test/java/Features/ChromeBrowser.feature",
                glue = "src/test/java/StepDefinitions/",
                tags = {"@run"},
                plugin = {
                        "pretty",
                        "html:output/cucumber/cucumber.html",
                        "json:output/cucumber/cucumber.json",
                        "junit:output/cucumber/cucumber.xml"
                }, monochrome = true))

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