我可以在不创建 maven 项目的情况下使用 Java + Eclipse + Cucumber 创建自动化脚本吗?

Can I create an automation script with Java + Eclipse + Cucumber without creation a marven project?

我想在eclipse项目中生成自动化测试报告。我没有创建 marven 项目,而是使用 Eclipse、Cucumber 和 Selenium 网络驱动程序进行自动化脚本编写。但是我找不到如何生成自动化报告。

请告诉我是否有办法为 Java eclipse 项目生成自动化报告。我已经创建了主要 class。如下

package mCollector;

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(
        format = {"pretty","html:target"},
        features = {"src"}
        )

public class mCollectorRunner {

}

但仅此而已,我无法生成自动化脚本。我遗漏了哪些额外的部分。

如果您使用的是 junit,class 应该有一个 Test 注释。当你 运行ning 它时,选择 运行 作为 junit 而不是 运行 作为 java 应用程序。 之后,使用ant生成报告是一种简单的方法。

运行 你的 class 作为 JUnit,那么你应该在测试后在目标文件夹中有 report.html,你可以通过更改行

来更改报告输出的目录
...
    format = {"pretty","html:target"},
...

...
    format = {"pretty","html:test-reports"},
...

它将在您的项目目录中创建名为 'test-reports' 的文件夹。