Skip to content

Commit

Permalink
Merge pull request #66 from zebrunner/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
SergeyBrenko authored Sep 3, 2024
2 parents 45511a3 + e425aef commit cd1fb29
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ private TestInvocationContext buildTestStartInvocationContext(ITestResult testRe
}

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

Expand Down Expand Up @@ -295,6 +294,10 @@ public void registerAfterTestFinish() {
registrar.registerAfterTestFinish();
}

public void clearConfigurationLogs() {
registrar.clearConfigurationLogs();
}

private TestInvocationContext buildTestInvocationContext(ITestNGMethod testMethod, int dataProviderIndex, Object[] parameters, int invocationIndex) {
String displayName = null;
Test testAnnotation = testMethod.getConstructorOrMethod()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ private static RetryItemContext getOrInitRetryItemContext(ITestNGMethod method,
}

public static boolean isRetryFinished(ITestNGMethod method, ITestContext context) {
if (method == null) {
// method is not available for BeforeClass configuration method, so we just return true here
return true;
}
return getRetryContext(context)
.map(RetryContext::getRetryItemContexts)
.map(retryItemContext -> retryItemContext.get(method.getParameterInvocationCount()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ public void beforeConfiguration(ITestResult tr, ITestNGMethod tm) {
if (testMethod instanceof ConfigurationMethod) {
ConfigurationMethod configurationMethod = (ConfigurationMethod) testMethod;

//unable to register test for before suite because all tests reported to the single test

if (configurationMethod.isBeforeClassConfiguration()) {
adapter.registerHeadlessTestStart(tr, tm);
}

if (configurationMethod.isBeforeMethodConfiguration()) {
adapter.registerHeadlessTestStart(tr, tm);
}
Expand Down Expand Up @@ -130,6 +124,10 @@ private void registerFinishOfAfterMethod(ITestResult testResult) {
if (testMethod instanceof ConfigurationMethod) {
ConfigurationMethod configurationMethod = (ConfigurationMethod) testMethod;

if(configurationMethod.isAfterClassConfiguration() ||
configurationMethod.isAfterTestConfiguration()) {
adapter.clearConfigurationLogs();
}
if (configurationMethod.isAfterMethodConfiguration()) {
adapter.registerAfterTestFinish();
}
Expand Down

0 comments on commit cd1fb29

Please sign in to comment.