From 6553e8fe32e0ca7a955f2aeb7e5ee0b54e83774c Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 12 Nov 2024 14:02:29 +0300 Subject: [PATCH] Fix tests --- .../epam/reportportal/testng/TestNGService.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/epam/reportportal/testng/TestNGService.java b/src/main/java/com/epam/reportportal/testng/TestNGService.java index 8027ce9..e353b74 100644 --- a/src/main/java/com/epam/reportportal/testng/TestNGService.java +++ b/src/main/java/com/epam/reportportal/testng/TestNGService.java @@ -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); @@ -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) { @@ -516,10 +520,6 @@ && getAttribute(testResult, RP_RETRY) != null))) { processFinishRetryFlag(testResult, rq); - if (type == TestMethodType.STEP) { - rq.setIssue(createIssue(testResult)); - } - Maybe finishItemResponse = launch.get().finishTestItem(itemId, rq); if (launch.get().getParameters().isCallbackReportingEnabled()) { updateTestItemTree(finishItemResponse, testResult);