Skip to content

Commit cd1fb29

Browse files
author
Sergey Brenko
authored
Merge pull request #66 from zebrunner/develop
Develop
2 parents 45511a3 + e425aef commit cd1fb29

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

src/main/java/com/zebrunner/agent/testng/adapter/TestNGAdapter.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,7 @@ private TestInvocationContext buildTestStartInvocationContext(ITestResult testRe
133133
}
134134

135135
private void setZebrunnerTestIdOnRerun(ITestResult testResult, ITestNGMethod testMethod, TestStartDescriptor testStartDescriptor) {
136-
// testMethod is not available for BeforeClass configuration method, so we just skip this logic in such case
137-
if (RunContextHolder.isRerun() && testMethod != null) {
136+
if (RunContextHolder.isRerun()) {
138137
ITestContext context = testResult.getTestContext();
139138
Object[] parameters = testResult.getParameters();
140139

@@ -295,6 +294,10 @@ public void registerAfterTestFinish() {
295294
registrar.registerAfterTestFinish();
296295
}
297296

297+
public void clearConfigurationLogs() {
298+
registrar.clearConfigurationLogs();
299+
}
300+
298301
private TestInvocationContext buildTestInvocationContext(ITestNGMethod testMethod, int dataProviderIndex, Object[] parameters, int invocationIndex) {
299302
String displayName = null;
300303
Test testAnnotation = testMethod.getConstructorOrMethod()

src/main/java/com/zebrunner/agent/testng/listener/RetryService.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ private static RetryItemContext getOrInitRetryItemContext(ITestNGMethod method,
9090
}
9191

9292
public static boolean isRetryFinished(ITestNGMethod method, ITestContext context) {
93-
if (method == null) {
94-
// method is not available for BeforeClass configuration method, so we just return true here
95-
return true;
96-
}
9793
return getRetryContext(context)
9894
.map(RetryContext::getRetryItemContexts)
9995
.map(retryItemContext -> retryItemContext.get(method.getParameterInvocationCount()))

src/main/java/com/zebrunner/agent/testng/listener/TestRunListener.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ public void beforeConfiguration(ITestResult tr, ITestNGMethod tm) {
9595
if (testMethod instanceof ConfigurationMethod) {
9696
ConfigurationMethod configurationMethod = (ConfigurationMethod) testMethod;
9797

98-
//unable to register test for before suite because all tests reported to the single test
99-
100-
if (configurationMethod.isBeforeClassConfiguration()) {
101-
adapter.registerHeadlessTestStart(tr, tm);
102-
}
103-
10498
if (configurationMethod.isBeforeMethodConfiguration()) {
10599
adapter.registerHeadlessTestStart(tr, tm);
106100
}
@@ -130,6 +124,10 @@ private void registerFinishOfAfterMethod(ITestResult testResult) {
130124
if (testMethod instanceof ConfigurationMethod) {
131125
ConfigurationMethod configurationMethod = (ConfigurationMethod) testMethod;
132126

127+
if(configurationMethod.isAfterClassConfiguration() ||
128+
configurationMethod.isAfterTestConfiguration()) {
129+
adapter.clearConfigurationLogs();
130+
}
133131
if (configurationMethod.isAfterMethodConfiguration()) {
134132
adapter.registerAfterTestFinish();
135133
}

0 commit comments

Comments
 (0)