Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Nov 12, 2024
1 parent edbd871 commit 6553e8f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/com/epam/reportportal/testng/TestNGService.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ private void processFinishRetryFlag(ITestResult testResult, FinishTestItemRQ rq)
TestMethodType type = getAttribute(testResult, RP_METHOD_TYPE);

boolean isRetried = testResult.wasRetried();
if (TestMethodType.STEP == type && getAttribute(testResult, RP_RETRY) == null && isRetried) {
if (TestMethodType.STEP == type && getAttribute(testResult, RP_RETRY) == null && isRetried && rq.getIssue() == null) {
RETRY_STATUS_TRACKER.put(instance, Boolean.TRUE);
rq.setRetry(Boolean.TRUE);
rq.setIssue(Launch.NOT_ISSUE);
Expand Down Expand Up @@ -498,14 +498,18 @@ public void finishTestMethod(ItemStatus status, ITestResult testResult) {
TestMethodType type = getAttribute(testResult, RP_METHOD_TYPE);
Object instance = testResult.getInstance();

if (type == TestMethodType.STEP) {
rq.setIssue(createIssue(testResult));
}

// TestNG does not repeat before methods if an after method fails during retries. But reports them as skipped.
// Mark before methods as not an issue if it is not a culprit.
if (instance != null) {
if (ItemStatus.FAILED == status && (TestMethodType.BEFORE_METHOD == type || TestMethodType.BEFORE_CLASS == type)) {
SKIPPED_STATUS_TRACKER.put(instance, Boolean.TRUE);
}
if (ItemStatus.SKIPPED == status && (SKIPPED_STATUS_TRACKER.containsKey(instance) || (TestMethodType.BEFORE_METHOD == type
&& getAttribute(testResult, RP_RETRY) != null))) {
if (status == ItemStatus.SKIPPED && rq.getIssue() == null
&& (SKIPPED_STATUS_TRACKER.containsKey(instance) || (TestMethodType.BEFORE_METHOD == type && getAttribute(testResult, RP_RETRY) != null))) {
rq.setIssue(Launch.NOT_ISSUE);
}
if (ItemStatus.SKIPPED == status && BEFORE_METHODS.contains(type) && testResult.getThrowable() != null) {
Expand All @@ -516,10 +520,6 @@ && getAttribute(testResult, RP_RETRY) != null))) {

processFinishRetryFlag(testResult, rq);

if (type == TestMethodType.STEP) {
rq.setIssue(createIssue(testResult));
}

Maybe<OperationCompletionRS> finishItemResponse = launch.get().finishTestItem(itemId, rq);
if (launch.get().getParameters().isCallbackReportingEnabled()) {
updateTestItemTree(finishItemResponse, testResult);
Expand Down

0 comments on commit 6553e8f

Please sign in to comment.