gpt4 book ai didi

ant - 为自己的框架创建新的 allure 适配器

转载 作者:行者123 更新时间:2023-12-03 05:32:05 27 4
gpt4 key购买 nike

我正在尝试为我们自己的框架创建适配器。我们的框架使用自己的断言机制,因此我需要编写适配器。

适配器类非常简单,如下所示:

public class AllureReportListener {

private static AllureReportListener object = new AllureReportListener();

private Allure lifecycle = Allure.LIFECYCLE;

private String suiteUid = UUID.randomUUID().toString();

private Set<String> startedTestNames = Collections.newSetFromMap(
new ConcurrentHashMap<String, Boolean>());

public static AllureReportListener getReportListener()
{
return object;
}

public void onTestSuiteStart(String testCaseName)
{
getLifecycle().fire(new TestSuiteStartedEvent(
suiteUid,testCaseName
));
}

public void onTestSuiteFinish()
{
getLifecycle().fire(new TestSuiteFinishedEvent(suiteUid));
}

Allure getLifecycle() {
return lifecycle;
}
}

我们自己的测试套件类在正确的事件时间调用这些方法。

由于我们有自己的测试框架,因此我们有自己的 ant 任务,名为 ownrunner,如下所示:

<target name="test">
<ownrunner classpathref="classpath" file="config/usecase/SEEDLoginCase.xml" parallel="Scenario" output="${build.report}">
</ownrunner>
</target>

我运行了 ant 构建,但在构建文件夹中没有看到任何 allure 结果。

现在我震惊了。我希望这个 ant 任务生成 allure xml 结果。我需要做什么?

最佳答案

您还需要启动方面 jar,它是 ant 构建的一部分。将此行添加到您的构建中:

<jvmarg value="-javaagent:${currentDir}/aspectjweaver-1.8.0.jar"/>

这将帮助您在您配置的目录下获得诱惑结果。

关于ant - 为自己的框架创建新的 allure 适配器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25946456/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com