0

我已经设计了我的固件,并且我已经在包中准确地放置了跑步者和步骤文件。但我无法运行 TC,它说测试未决,但步骤已定义。

PFA 我的项目结构。 在此处输入图像描述

我的步骤文件:

package com.reThink.steps;

import net.thucydides.core.annotations.Steps;

import com.reThink.helper.LoginHelper;
import com.reThink.util.CBTestProperties;
import com.reThink.util.Constants;
import com.reThink.util.Log;

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

public class LoginSteps {

@Steps
LoginHelper loginHelper;

private String username = null;
private String password = null;

/**
 * Method to navigate to login page
 * 
 * @param
 * @return
 */
@Given("^I am on the reThink Login page$")
public void givenIamonthehomepage() throws Exception {
    loginHelper.openLoginPage();
}

/**
 * Method to login as a Admin user
 * 
 * @param
 * @return
 */
@When("^I login as an Admin user$")
public void loginWithAdminUser() throws Exception {
    loginHelper.openLoginPage();
    username = CBTestProperties.Instance
            .getTestProperty(Constants.ADMINUSERNAME);
    password = CBTestProperties.Instance
            .getTestProperty(Constants.ADMINPASSWORD);
    loginHelper.loginToRethink(username, password);
}

/**
 * I should be login successfully
 * 
 * @param
 * @return
 */
@Then("^I should be logged in successfully$")
public void thenItShouldBeLoggedIn() throws Exception {
    // assertThat(homePageHelper.isLoginSuccessful(username));
    Log.info("Successfully logged in");
}

}

特征文件

@Logon_Admin_User
Scenario: Login to reThink with Admin User credentials 
Given I am on the reThink Login page
When I login as an Admin user 
Then I should be logged in successfully 
4

1 回答 1

1

您在 runner 类的黄瓜选项中缺少胶水路径。请尝试以下方法。

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features="src/test/resources/features",tags="@Logon_Admin_user",glue = { "com.reThink.steps" })
public class TestRunnerSuite{}
于 2017-06-30T13:00:22.420 回答