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

bat*_*man 3 ant allure

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

适配器类非常简单,它看起来像这样:

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;
    }
}
Run Code Online (Sandbox Code Playgroud)

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

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

<target name="test">
    <ownrunner classpathref="classpath" file="config/usecase/SEEDLoginCase.xml" parallel="Scenario" output="${build.report}">
    </ownrunner>
</target>
Run Code Online (Sandbox Code Playgroud)

我运行了ant build,但是我没有在build文件夹中看到任何诱惑结果.

现在我很震惊.我希望这个ant任务生成诱惑xml结果.我需要做什么?

Ant*_*t's 6

你需要启动方面jar,这是ant build的一部分.将此行添加到您的构建中:

<jvmarg value="-javaagent:${currentDir}/aspectjweaver-1.8.0.jar"/>
Run Code Online (Sandbox Code Playgroud)

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