종속성 단계 정의가 표시되지 1.2.4 의 JUnit - 4.11 오이-2.12.2 오이 JVM-deps은-1.0.3셀레늄/오이 폴더 마이그레이션 한 후이 사용
나는 최근에 내 종속 폴더 구조를 정리하고 생각 내가 뭔가를 잘못했을 수도 있지만, 내 문제는 인스턴스화 문제입니다 그건 말이 안되기 때문에 오이쪽에 연속으로 오리가있어. 여기에 스택 추적은 다음과 같습니다
cucumber.runtime.CucumberException: Failed to instantiate class cucumber.feature.LoginandMeetingCreation
at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance(DefaultJavaObjectFactory.java:46)
at cucumber.runtime.java.DefaultJavaObjectFactory.getInstance(DefaultJavaObjectFactory.java:32)
at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:38)
at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37)
at cucumber.runtime.Runtime.runStep(Runtime.java:299)
at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44)
at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
at cucumber.runtime.Runtime.run(Runtime.java:121)
at cucumber.api.cli.Main.run(Main.java:36)
at cucumber.api.cli.Main.main(Main.java:18)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance(DefaultJavaObjectFactory.java:40)
... 11 more
Caused by: java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:770)
at org.openqa.selenium.support.ui.FluentWait.<init>(FluentWait.java:96)
at org.openqa.selenium.support.ui.WebDriverWait.<init>(WebDriverWait.java:71)
at org.openqa.selenium.support.ui.WebDriverWait.<init>(WebDriverWait.java:45)
at cucumber.feature.LoginandMeetingCreation.<init>(LoginandMeetingCreation.java:19)
... 16 more
여기에 기능 파일을 설정 내 오이 주자이지만, 결코 접착제 명령을 실행하지 않습니다. 단계를
package cucumberInitialization;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
plugin = {"pretty" , "json:target/cucumber.json"},
features = {"src/cucumber/"},
monochrome = true,
glue = {"cucumber.feature"}
)
public class cucumberRunner {
}
기능 파일 :
Feature: Create a meeting and fill in the necessary text fields
Scenario: As a user, login and create a meeting
Given I navigated to the site
When I login and select an org
Then Create a meeting
그리고 마지막으로 내 단계 정의 :
package cucumber.feature;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import cucumber.api.PendingException;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class LoginandMeetingCreation {
WebDriver chromeDriver = null;
WebDriver ieDriver = null;
//open IE and Chrome browsers and go to Website
@Given("^I navigated to the site$")
public void navigateToWebsite() throws Throwable{
throw new PendingException();
}
//login users
@When("^I login and select an org$")
public void userLogin() throws Throwable{
throw new PendingException();
}
@Then("^Create a meeting$")
public void meetingCreation() throws Throwable{
throw new PendingException();
}
}
어떤 조언을 내 패키지 cucumber.feature 내 단계 정의 파일 LoginandMeetingCreation.java 파일이 들어?
내게 말할 수 있습니까? Line LoginandMeetingCreation.java:19에 무엇이 있습니까? – GAlexMES
LoginandMeetingCreation 생성자에서 가져 오기에 이르기까지 마지막 코드 단편에 표시된 모든 코드. 전체 .java 파일 – potatocode
그럼 문제는 null로 newWebDriver (ieDriver, 2)를 호출한다는 것입니다. 또한 WebDriverWait은 드라이버가없는 경우 초기화 할 수 없습니다. – GAlexMES