未为TestNG执行测试

问题描述 投票:0回答:1

试图使用TestNG运行我的所有Cucumber测试。但是找不到我的套件。

我看到了一些关于stackoverflow的问题,但没有一个解决了我的问题。

Runner-junitRunner.java

package testRunner;

import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.SnippetType;
import cucumber.api.junit.Cucumber;

//@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/resources/features/",
glue = "br.mysteps.steps"
)

public class junitRunner {

}

testng.xml

<suite name="SeleniumSuite">
<test name="testAll">
       <classes>
          <class name="testRunner.junitRunner"/>
       </classes>
</test>
</suite>

pom.xml

<dependencies>
    <dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>1.2.5</version>
</dependency>

    <dependency>
        <groupId>org.testng</groupId>       
        <artifactId>testng</artifactId>
        <version>6.11</version>
    </dependency>
</dependencies>

当我以TestNG运行testng.xml文件时,找不到以下测试内容

[RemoteTestNG] detected TestNG version 6.11.0
[TestNGContentHandler] [WARN] It is strongly recommended to add "<!DOCTYPE 
suite SYSTEM "http://testng.org/testng-1.0.dtd" >" at the top of your 
file, otherwise TestNG may fail or not work as expected.

===============================================
SeleniumSuite
Total tests run: 0, Failures: 0, Skips: 0
===============================================
java automated-tests cucumber testng
1个回答
1
投票

如果您想基本使用TestNG来运行您的黄瓜测试,则需要扩展cucumber.api.testng.AbstractTestNGCucumberTests

有关如何使用TestNG进行黄瓜测试的更多详细示例,请参阅示例here

© www.soinside.com 2019 - 2024. All rights reserved.