错误:找不到或装入黄瓜和testNG的主类

时间:2019-02-15 09:01:34

标签: selenium cucumber testng

我正在尝试使用TestNG和Cucumber创建一个Selenium项目。 当我尝试从Cucumber的Runner文件或TestNG XML文件执行测试用例时,出现以下错误:

Error: Unable to initialize main class org.testng.remote.RemoteTestNG
Caused by: java.lang.NoClassDefFoundError: org/testng/TestNGException

当我尝试从Cucumber Feature文件执行测试用例时,出现以下错误:

Error: Could not find or load main class cucumber.api.cli.Main
Caused by: java.lang.ClassNotFoundException: cucumber.api.cli.Main

enter image description here 这是我项目的结构

RunnerClass:

@CucumberOptions(
        features = {"src/test/resources/features/Administration/Export.feature"}, 
        monochrome = true,
        plugin = {"pretty","html:target/Destination"}, 
        glue = {"valveAware.port.localhost.tests"}
        )



public class ValveAwareRunnerTest 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 thread-count="5" name="Test">
    <classes>
      <class name="valveAware.port.localhost.runner.ValveAwareRunnerTest"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->
VATestProject的

.classpath文件: enter image description here

添加了

个jar: enter image description here

我无法确定问题的原因。

0 个答案:

没有答案