0
我有一個maven
項目運行cucumber
和selenium
。在src/features
中定義了*.feature
文件,並且在src/test/java/com/example/steps
中定義了這些步驟。黃瓜:找不到類com.example.runner.RunnerTest
我還定義如下的測試轉輪類:
package com.example.runner;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
features={"src/features"},
glue="com/example/steps")
public class RunnerTest {
}
的問題是:當我運行的類其與抱怨:
Class not found com.example.runner.RunnerTest
java.lang.ClassNotFoundException: com.example.runner.RunnerTest
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:688)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
的問題是,爲什麼它不承認跑步者的命運?
更新:
當我運行通過
開放特徵文件的特徵文件 - >右鍵 - >運行爲 - > 1黃瓜功能
它效果不錯
我改變了glue="com/example/steps"
到glue="com.example.steps"
並與抱怨:
java.lang.NullPointerException
at com.example.steps.Click_Steps.i_am_in(Click_Steps.java:23)
at ✽.Given I am in "http://suvian.in/selenium/1.6checkbox.html"(CheckBox.feature:14)
,當我指的是文件:
base.getDriver().navigate().to(uri);
但正如我所說,這條線的工作非常好,當我運行的特徵文件使用Run as -> Cucumber