0
私はキュウリでtestNGフレームワークを使用しようとしています。しかし、以下のエラーを取得します。org.testng.testngexceptionがクラスcucmber-testngエラーをインスタンス化できません
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD FAILURE
[INFO] Total time: 8.032 s
[INFO] Finished at: 2016-08-02T16:11:29+05:30
[INFO] Final Memory: 18M/220M
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test (default-test) on project TestCaseAPI: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test failed: There was an error in the forked process
[ERROR] org.testng.TestNGException:
[ERROR]
[ERROR] Cannot instantiate class com.XXX.automation.feature.RunCuke1Test
[ERROR] at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:40)
マイランナークラスは以下の通りである:私のtestNG.xmlは
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test name="Test diary">
<classes>
<class name="com.XXX.automation.feature.RunCuke1Test"/>
</classes>
</test>
</suite>
を下回るようなものです
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import cucumber.api.testng.AbstractTestNGCucumberTests;
@RunWith(Cucumber.class)
@CucumberOptions (features = "src/test/resources/feature"
,glue="com.XXX.automation.feature"
,monochrome=true
)
public class RunCuke1Test extends AbstractTestNGCucumberTests {
}
私はMavenを通して実行する
誰でも私がここで間違っていることを教えてもらえますか?
testngとjunitテストを混在させています: '@RunWith(Cucumber.class)'を削除して起動してください – juherr
https://github.com/cucumber/cucumber-jvm/tree/master/examples/java-calculatorのサンプルを確認してください-testng – juherr
TestNG for Cucumberは使用できません。 Junitを使用してCucumberクラスを実行します。 –