Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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) execute the -jar
2) run the tests
3) generate the folder allure-results

the idea is to run without maven.

----- Solved

i create a main.

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"

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
357 views
Welcome To Ask or Share your Answers For Others

1 Answer

You need to add AllureJunit4 listener to JUnitCore:

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

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

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...