From 115f99422ae8ffb17e30df478e7b08775d258298 Mon Sep 17 00:00:00 2001 From: kirillbilchenko Date: Mon, 17 Feb 2020 15:14:10 +0100 Subject: [PATCH 1/7] Fix testng 7.1.x compatibility --- allure-testng/build.gradle.kts | 2 +- .../io/qameta/allure/testng/AllureTestNg.java | 40 +++++-------------- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/allure-testng/build.gradle.kts b/allure-testng/build.gradle.kts index dd43d7ecf..856ef92ae 100644 --- a/allure-testng/build.gradle.kts +++ b/allure-testng/build.gradle.kts @@ -2,7 +2,7 @@ description = "Allure TestNG Integration" val agent: Configuration by configurations.creating -val testNgVersion = "6.14.3" +val testNgVersion = "7.1.1" dependencies { agent("org.aspectj:aspectjweaver") diff --git a/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java b/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java index 67e07b271..e6fa2eee7 100644 --- a/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java +++ b/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java @@ -35,18 +35,7 @@ import io.qameta.allure.util.ResultsUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testng.IAttributes; -import org.testng.IClass; -import org.testng.IConfigurationListener; -import org.testng.IInvokedMethod; -import org.testng.IInvokedMethodListener2; -import org.testng.ISuite; -import org.testng.ISuiteListener; -import org.testng.ITestClass; -import org.testng.ITestContext; -import org.testng.ITestListener; -import org.testng.ITestNGMethod; -import org.testng.ITestResult; +import org.testng.*; import org.testng.annotations.Parameters; import org.testng.internal.ConstructorOrMethod; import org.testng.xml.XmlSuite; @@ -102,7 +91,7 @@ public class AllureTestNg implements ISuiteListener, ITestListener, - IInvokedMethodListener2, + IInvokedMethodListener, IConfigurationListener { private static final Logger LOGGER = LoggerFactory.getLogger(AllureTestNg.class); @@ -367,21 +356,18 @@ public void onTestFailedButWithinSuccessPercentage(final ITestResult result) { @Override public void beforeInvocation(final IInvokedMethod method, final ITestResult testResult) { - //do nothing - } - - @Override - public void beforeInvocation(final IInvokedMethod method, final ITestResult testResult, - final ITestContext context) { final ITestNGMethod testMethod = method.getTestMethod(); - if (isSupportedConfigurationFixture(testMethod)) { - ifSuiteFixtureStarted(context.getSuite(), testMethod); - ifTestFixtureStarted(context, testMethod); - ifClassFixtureStarted(testMethod); - ifMethodFixtureStarted(testMethod); + final ITestContext context = testResult.getTestContext(); + if (isSupportedConfigurationFixture(testMethod)) { + ifSuiteFixtureStarted(context.getSuite(), testMethod); + ifTestFixtureStarted(context, testMethod); + ifClassFixtureStarted(testMethod); + ifMethodFixtureStarted(testMethod); } + //do nothing } + private void ifSuiteFixtureStarted(final ISuite suite, final ITestNGMethod testMethod) { if (testMethod.isBeforeSuiteConfiguration()) { startBefore(getUniqueUuid(suite), testMethod); @@ -468,12 +454,6 @@ private FixtureResult getFixtureResult(final ITestNGMethod method) { @Override public void afterInvocation(final IInvokedMethod method, final ITestResult testResult) { - //do nothing - } - - @Override - public void afterInvocation(final IInvokedMethod method, final ITestResult testResult, - final ITestContext context) { final ITestNGMethod testMethod = method.getTestMethod(); if (isSupportedConfigurationFixture(testMethod)) { final String executableUuid = currentExecutable.get(); From 599b0c4dddb3a037eb4a8252666919a779c2d687 Mon Sep 17 00:00:00 2001 From: kirillbilchenko Date: Mon, 17 Feb 2020 15:23:11 +0100 Subject: [PATCH 2/7] formatting fix --- .../java/io/qameta/allure/testng/AllureTestNg.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java b/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java index e6fa2eee7..bba0a97c7 100644 --- a/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java +++ b/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java @@ -358,13 +358,12 @@ public void onTestFailedButWithinSuccessPercentage(final ITestResult result) { public void beforeInvocation(final IInvokedMethod method, final ITestResult testResult) { final ITestNGMethod testMethod = method.getTestMethod(); final ITestContext context = testResult.getTestContext(); - if (isSupportedConfigurationFixture(testMethod)) { - ifSuiteFixtureStarted(context.getSuite(), testMethod); - ifTestFixtureStarted(context, testMethod); - ifClassFixtureStarted(testMethod); - ifMethodFixtureStarted(testMethod); + if (isSupportedConfigurationFixture(testMethod)) { + ifSuiteFixtureStarted(context.getSuite(), testMethod); + ifTestFixtureStarted(context, testMethod); + ifClassFixtureStarted(testMethod); + ifMethodFixtureStarted(testMethod); } - //do nothing } From c8ff6c88618aedec6aa6c8ec19870b76bf5544fc Mon Sep 17 00:00:00 2001 From: kirillbilchenko Date: Mon, 17 Feb 2020 15:45:30 +0100 Subject: [PATCH 3/7] Revert test-ng version --- allure-testng/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allure-testng/build.gradle.kts b/allure-testng/build.gradle.kts index 856ef92ae..dd43d7ecf 100644 --- a/allure-testng/build.gradle.kts +++ b/allure-testng/build.gradle.kts @@ -2,7 +2,7 @@ description = "Allure TestNG Integration" val agent: Configuration by configurations.creating -val testNgVersion = "7.1.1" +val testNgVersion = "6.14.3" dependencies { agent("org.aspectj:aspectjweaver") From cc67e4cf2108539ec83c760d5a9f532f31c943ce Mon Sep 17 00:00:00 2001 From: kirillbilchenko Date: Mon, 17 Feb 2020 15:52:00 +0100 Subject: [PATCH 4/7] Fix import --- .../java/io/qameta/allure/testng/AllureTestNg.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java b/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java index bba0a97c7..7181dc236 100644 --- a/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java +++ b/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java @@ -35,7 +35,18 @@ import io.qameta.allure.util.ResultsUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testng.*; +import org.testng.IAttributes; +import org.testng.IClass; +import org.testng.IConfigurationListener; +import org.testng.IInvokedMethod; +import org.testng.IInvokedMethodListener2; +import org.testng.ISuite; +import org.testng.ISuiteListener; +import org.testng.ITestClass; +import org.testng.ITestContext; +import org.testng.ITestListener; +import org.testng.ITestNGMethod; +import org.testng.ITestResult; import org.testng.annotations.Parameters; import org.testng.internal.ConstructorOrMethod; import org.testng.xml.XmlSuite; From 35930b172c6d4d1b8b724770955f1eccef3004d3 Mon Sep 17 00:00:00 2001 From: kirillbilchenko Date: Mon, 17 Feb 2020 15:52:32 +0100 Subject: [PATCH 5/7] Fix import --- .../src/main/java/io/qameta/allure/testng/AllureTestNg.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java b/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java index 7181dc236..52b2ca8bd 100644 --- a/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java +++ b/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java @@ -39,7 +39,7 @@ import org.testng.IClass; import org.testng.IConfigurationListener; import org.testng.IInvokedMethod; -import org.testng.IInvokedMethodListener2; +import org.testng.IInvokedMethodListener; import org.testng.ISuite; import org.testng.ISuiteListener; import org.testng.ITestClass; From fb2db634b22e38d05e3b0153e63f0a8118267e8e Mon Sep 17 00:00:00 2001 From: kirillbilchenko Date: Mon, 17 Feb 2020 15:55:56 +0100 Subject: [PATCH 6/7] Formatting fix --- .../main/java/io/qameta/allure/testng/AllureTestNg.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java b/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java index 52b2ca8bd..f1ed30399 100644 --- a/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java +++ b/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java @@ -370,10 +370,10 @@ public void beforeInvocation(final IInvokedMethod method, final ITestResult test final ITestNGMethod testMethod = method.getTestMethod(); final ITestContext context = testResult.getTestContext(); if (isSupportedConfigurationFixture(testMethod)) { - ifSuiteFixtureStarted(context.getSuite(), testMethod); - ifTestFixtureStarted(context, testMethod); - ifClassFixtureStarted(testMethod); - ifMethodFixtureStarted(testMethod); + ifSuiteFixtureStarted(context.getSuite(), testMethod); + ifTestFixtureStarted(context, testMethod); + ifClassFixtureStarted(testMethod); + ifMethodFixtureStarted(testMethod); } } From d171b1bb4dc3e4c2c9114765fe25c44594b89b41 Mon Sep 17 00:00:00 2001 From: kirillbilchenko Date: Mon, 17 Feb 2020 16:00:15 +0100 Subject: [PATCH 7/7] Formatting fix --- .../src/main/java/io/qameta/allure/testng/AllureTestNg.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java b/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java index f1ed30399..f296ad9ca 100644 --- a/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java +++ b/allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java @@ -368,7 +368,7 @@ public void onTestFailedButWithinSuccessPercentage(final ITestResult result) { @Override public void beforeInvocation(final IInvokedMethod method, final ITestResult testResult) { final ITestNGMethod testMethod = method.getTestMethod(); - final ITestContext context = testResult.getTestContext(); + final ITestContext context = testResult.getTestContext(); if (isSupportedConfigurationFixture(testMethod)) { ifSuiteFixtureStarted(context.getSuite(), testMethod); ifTestFixtureStarted(context, testMethod);