在SerenityBDD中执行它们时,所有JBehave步骤都标记为PENDING

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

我正在尝试使用Serenity BDD和JBehave框架中的登录功能执行一个非常简单的故事。但是,我的所有步骤都标记为PENDING并跳过。请帮我理解我的代码出了什么问题。

我确保我的Story文件和Step文件中的步骤完全匹配,并且在空格或制表符方面没有区别。

故事档案

Story: Application Login

Narrative:
As an user, I want to successfully login into the application upon providing valid credential

Scenario:  Login with valid credential
Given Launch the application
When Input the credential
Then Login to the application

步骤类

import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Then;
import org.jbehave.core.annotations.When;
import net.thucydides.core.annotations.Steps;
import tests.LoginTest;

public class LoginSteps {

    @Steps
    LoginTest usr;

    @Given("Launch the application")
    public void launchApp() {
        usr.beforeSuite();
        usr.launchApplication();
    }

    @When("Input the credential")
    public void enterCredential() {
        usr.submitLoginForm();
    }

    @Then("Login to the application")
    public void loginApp() {
        usr.loginCheck();
        usr.afterSuite();
    }
}

测试类

package suite;

import net.serenitybdd.jbehave.SerenityStory;

public class Login extends SerenityStory {

}

POM.HML

<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>com.selenium.bdd.serenity</groupId>
<artifactId>seleniumBDDSerenity</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>seleniumBDDSerentity</name>
<url>http://maven.apache.org</url>

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

<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.5</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-chrome-driver</artifactId>
        <version>3.14.0</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-core</artifactId>
        <version>2.0.33</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-jbehave</artifactId>
        <version>1.44.0</version>
    </dependency>
    <dependency>
        <groupId>org.jbehave</groupId>
        <artifactId>jbehave-core</artifactId>
        <version>4.3.5</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>3.0.0-M3</version>
            <configuration>
                <includes>
                    <include>**/suite/*.java</include>
                </includes>
                <skipTests>false</skipTests>
                <failIfNoTests>false</failIfNoTests>
            </configuration>
            <executions>
                <execution>
                    <id>integration-test</id>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>net.serenity-bdd.maven.plugins</groupId>
            <artifactId>serenity-maven-plugin</artifactId>
            <version>2.0.33</version>
            <executions>
                <execution>
                    <id>serenity-reports</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

日志

(BeforeStories)

Running story stories/authentication/Login.story
Application Login
(stories/authentication/Login.story)
Using timeout for story Login.story of 300 secs.

Scenario: Login with valid credential
Given Launch the application (PENDING)
When Input the credential (PENDING)
Then Login to the application (PENDING)

@Given("Launch the application")
@Pending
public void givenLaunchTheApplication() {
  // PENDING
}

@When("Input the credential")
@Pending
public void whenInputTheCredential() {
  // PENDING
}

@Then("Login to the application")
@Pending
public void thenLoginToTheApplication() {
  // PENDING
}

(AfterStories)
annotations pojo jbehave serenity-bdd scenarios
1个回答
0
投票

我有同样的问题,我修复了它。将runner类移动到放置LoginSteps的同一文件夹。

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