我已经设计了我的FW,我已经在包中准确地放置了runner和step文件。但我无法运行TC,它显示Test pending,尽管定义了步骤。
PFA我的项目结构。enter image description here
我的step文件:
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 发布于 2017-06-30 21:00:22
runner类的cucumber选项中缺少胶水路径。请尝试以下内容。
@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features="src/test/resources/features",tags="@Logon_Admin_user",glue = { "com.reThink.steps" })
public class TestRunnerSuite{}https://stackoverflow.com/questions/44844902
复制相似问题