私はCucumberRunnerを実行したときに開始しないキュウリとFluentleniumプロジェクトを持っています。それは単にすべてのテストをスキップします。私はインターネット上で解決策を見つけようとしましたが、これまで問題を理解していませんでした。ちょっとした助けがよかったです。Fluentleniumとキュウリの試験が開始されていません
public class LoginPageSteps extends BaseTest {
public LoginPageSteps() throws Exception {
super();
}
@Page
LoginPage loginPage;
@Given("^I am on login page$")
public void goToLoginPage(){
goTo(loginPage);
}
@When("^I enter username as '(.*?)'$")
public void enterUsername(String username) {
waitAndFill(loginPage.username, username);
}
@And("^I enter password as '(.*?)'$")
public void enterPassword(String password) {
waitAndFill(loginPage.password, password);
waitUntilCliclableAndClick(loginPage.loginButton);
}
@Then("^Login should be succesfull$")
public void checkLoginStatus() {
assertTrue(getDriver().getCurrentUrl().contains("login_attempt=1"));
}
}
これは私のBaseTest.classです::これは
は私の手順です
public class BaseTest extends FluentCucumberTest {
@Page
AccountPage accountPage;
@Before
public void before(Scenario scenario) {
super.before(scenario);
}
@After
public void after(Scenario scenario) {
super.after(scenario);
}
@Override
public WebDriver newWebDriver() {
System.setProperty("webdriver.gecko.driver", "../cucumber-test/src/test/resources/geckodriver.exe");
FirefoxDriver driver = new FirefoxDriver();
return driver;
}
public void waitUntilCliclableAndClick(FluentWebElement element) {
await().atMost(5, TimeUnit.SECONDS).until(element).clickable();
element.click();
}
public void waitAndFill(FluentWebElement element, String data) {
await().atMost(5, TimeUnit.SECONDS).until(element).displayed();
element.fill().with(data);
}
}
そして、これは私の機能ファイルです:
Feature: valid-login
Scenario:
Given I am on login page
When I enter username as "myusername"
And I enter password as "mypassword"
Then Login should be succesfull
そして、これはランナーです:
@RunWith(Cucumber.class)
@CucumberOptions(features={"src/test/resources/features"})
public class CucumberRunner {
}
どのキュウリのバージョンを使用しましたか? –
サンプルプロジェクトのキュウリの古いバージョンと思われます。サンプルプロジェクトを調査/更新し、あなたに戻ってきます。 –
あなたのシナリオを試してみましたが、動作しますが、実行時にnullなので@BeforeでgetDriver()を呼び出すことができないため、私の場合は動作しません。 newWebDriver()メソッドをオーバーライドして、前回の代わりにドライバを設定したいのは、1回だけ実行したいからです。 Beforeを呼び出すと、他のテストが実行されたときにドライバが再び初期化されます。 –