诱惑-用jar生成诱惑结果 [英] Allure - generate allure-results with jar

查看:92
本文介绍了诱惑-用jar生成诱惑结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有依赖项和类的大型Java .jar,当执行.jar时,我需要生成"allure-results"文件夹,这有可能吗?

I have a big java .jar with dependencies and classes, when excute the .jar, I need to generate the folder "allure-results", Is it possible to do that?

1)执行-jar
2)运行测试
3)生成文件夹诱惑结果

1) execute the -jar
2) run the tests
3) generate the folder allure-results

这个想法是在没有maven的情况下运行.

the idea is to run without maven.

-----已解决

我创建了一个主线.

public static void main(String[] args) {

       JUnitCore engine = new JUnitCore();
       engine.addListener(new AllureJunit4());
       engine.run(testsSuitName.class);

 }

执行胖罐子并测试其正常时,罐子将创建诱惑结果"文件夹

when you exec the fat jar and the test its ok, the jar create the folder "allure-results"

推荐答案

您需要将 AllureJunit4 侦听器添加到 JUnitCore :

You need to add AllureJunit4 listener to JUnitCore:

JUnitCore engine = new JUnitCore();
engine.addListener(new AllureJunit4());
engine.run(testsSuitName.class);

然后,在运行胖jar时需要指定AspectJ Weaver javaagent:

Then you need to specify AspectJ Weaver javaagent when run your fat jar:

$ java -jar --javaagent:"/path/to/aspectjweaver.jar" tests.jar

为了配置结果文件夹,您可以使用 allure.results.directory 系统属性

In order to configure results folder you can use allure.results.directory system property

这篇关于诱惑-用jar生成诱惑结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆