Skip to content

Commit 6f2c272

Browse files
ehborisovbaev
authored andcommitted
junit4 aspect listener + local spi-off distribution fixes (via allure-framework#74)
1 parent a8320c4 commit 6f2c272

File tree

7 files changed

+59
-1
lines changed

7 files changed

+59
-1
lines changed

allure-junit4-aspect/build.gradle

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<aspectj>
2+
<aspects>
3+
<aspect name="io.qameta.allure.junit4.AllureJunit4ListenerAspect"/>
4+
</aspects>
5+
</aspectj>

allure-junit5/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ configurations {
6161

6262
artifacts {
6363
spiOff spiOffJar
64+
archives spiOffJar
6465
}

allure-testng/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ configurations {
5555

5656
artifacts {
5757
spiOff spiOffJar
58+
archives spiOffJar
5859
}

gradle/bintray.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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 {

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ include 'allure-attachments'
1010
include 'allure-okhttp3'
1111
include 'allure-httpclient'
1212
include 'allure-rest-assured'
13+
include 'allure-junit4-aspect'
1314

1415
def examples = [
1516
'testng',

0 commit comments

Comments
 (0)