1

我正在使用扩展 AbstractTestNGCucumberTests 的 TestRunner 类在 Testng 中运行黄瓜功能文件。在我使用 ApprovalTests 验证从数据库获得的响应的最后一步中,我遇到了一个问题。我看到一个异常

"com.spun.util.FormattedException: Didn't find cucumber.api.testng.AbstractTestNGCucumberTests under C:\Users\nsyed\Awris2\LearnDatabase"

有谁知道为什么会出现这个异常?我的跑步者课程是:

@CucumberOptions(features = {"src/test/java/Features/ValidateStagingDB.feature"}
,glue={"StepDefinition"}
,dryRun=false
,strict=true
,public class TestRunner extends AbstractTestNGCucumberTests{}`

例外情况在 Approvals.VerifyAsJso

@Then("^响应应该匹配黄金副本$") public void the_response_should_match_the_golden_copy() throws Throwable {

    try {

        Approvals.verifyAsJson(DbHelper2.getJsonRepresentationFor(TableData));
    }
    catch(Exception e) {
        System.err.println(e);
    }
    finally {
        System.out.println("Closing the database connection");
        connection.close();
    }
4

1 回答 1

0

您可以尝试将 cucumber-jvm.jar 包含在您的路径文件夹中吗?这里是下载位置:https ://mvnrepository.com/artifact/info.cukes/cucumber-jvm

如果您是基于 maven 的项目,请添加此依赖项。

如果问题没有解决,您可以尝试将 cucumber-jvm 粘贴到错误消息中显示的路径中。这样我们就可以确定它是路径中缺少的二进制文件。如果成功,您必须找出所有罐子应该进入的正确路径。

于 2018-09-19T04:44:34.857 回答