0

我正在尝试在黄瓜中使用 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)

我的跑步者课程如下:

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 {       
    }  

我的 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>

我的项目结构如上: 在此处输入图像描述

我正在通过 Maven 运行它

谁能告诉我我在这里做错了什么?

4

1 回答 1

1

我确实重新检查了 cucumber-testNG maven 依赖项。早些时候我使用的是旧版本。我现在正在使用最新版本,现在我的程序正在成功运行。

于 2016-08-02T17:09:58.913 回答