File tree Expand file tree Collapse file tree 7 files changed +59
-1
lines changed
java/io/qameta/allure/junit4 Expand file tree Collapse file tree 7 files changed +59
-1
lines changed Original file line number Diff line number Diff line change 1+ description = ' Aspect for Allure JUnit 4 listener'
2+
3+ apply plugin : ' java'
4+ apply from : " ${ gradleScriptDir} /maven-publish.gradle"
5+ apply from : " ${ gradleScriptDir} /bintray.gradle"
6+
7+
8+ repositories {
9+ mavenCentral()
10+ }
11+
12+ configurations {
13+ agent
14+ }
15+
16+ dependencies {
17+ agent ' org.aspectj:aspectjweaver'
18+ compileOnly ' org.aspectj:aspectjrt'
19+ compileOnly ' junit:junit:4.12'
20+ compile project(' :allure-junit4' )
21+
22+ testCompile ' junit:junit:4.12'
23+ }
Original file line number Diff line number Diff line change 1+ package io .qameta .allure .junit4 ;
2+
3+ import org .aspectj .lang .JoinPoint ;
4+ import org .aspectj .lang .annotation .After ;
5+ import org .aspectj .lang .annotation .Aspect ;
6+ import org .aspectj .lang .annotation .Pointcut ;
7+ import org .junit .runner .notification .RunNotifier ;
8+
9+ /**
10+ * @author Egor Borisov [email protected] 11+ */
12+ @ Aspect
13+ public class AllureJunit4ListenerAspect {
14+
15+ private final AllureJunit4 allureJunit4 = new AllureJunit4 ();
16+
17+ @ Pointcut ("execution(org.junit.runner.notification.RunNotifier.new())" )
18+ public void run () {
19+ //empty pointcut body
20+ }
21+
22+ @ After ("run()" )
23+ public void run (final JoinPoint point ) {
24+ final RunNotifier notifier = (RunNotifier ) point .getThis ();
25+ notifier .addListener (allureJunit4 );
26+ }
27+ }
Original file line number Diff line number Diff line change 1+ <aspectj >
2+ <aspects >
3+ <aspect name =" io.qameta.allure.junit4.AllureJunit4ListenerAspect" />
4+ </aspects >
5+ </aspectj >
Original file line number Diff line number Diff line change @@ -61,4 +61,5 @@ configurations {
6161
6262artifacts {
6363 spiOff spiOffJar
64+ archives spiOffJar
6465}
Original file line number Diff line number Diff line change @@ -55,4 +55,5 @@ configurations {
5555
5656artifacts {
5757 spiOff spiOffJar
58+ archives spiOffJar
5859}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ bintray {
44 user = project. hasProperty(' bintrayUser' ) ? project. property(' bintrayUser' ) : System . getenv(' BINTRAY_USER' )
55 key = project. hasProperty(' bintrayApiKey' ) ? project. property(' bintrayApiKey' ) : System . getenv(' BINTRAY_API_KEY' )
66
7- configurations = [' archives' , ' spiOff ' ]
7+ configurations = [' archives' ]
88
99 publish = true
1010 pkg {
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ include 'allure-attachments'
1010include ' allure-okhttp3'
1111include ' allure-httpclient'
1212include ' allure-rest-assured'
13+ include ' allure-junit4-aspect'
1314
1415def examples = [
1516 ' testng' ,
You can’t perform that action at this time.
0 commit comments