Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution summary report enhancements #1363

Merged
merged 5 commits into from
Nov 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Execution Summary Report enhancements - multiple annotations values
  • Loading branch information
MahmoudElSharkawy committed Nov 12, 2023
commit c99b4d1ebe5427abf700449f0782d6bcaeb0ff09
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.qameta.allure.Issue;
import io.qameta.allure.Issues;
import io.qameta.allure.TmsLink;
import io.qameta.allure.TmsLinks;
import org.openqa.selenium.Platform;
import org.openqa.selenium.remote.Browser;
import org.testng.*;
Expand Down Expand Up @@ -260,16 +261,17 @@
}
}

public static Boolean testHasIssueAnnotation(ITestResult iTestResult) {
var method = iTestResult.getMethod().getConstructorOrMethod().getMethod();
Issue issue = method.getAnnotation(Issue.class);
return issue != null;
}

public static String getIssueAnnotationValue(ITestResult iTestResult) {
var method = iTestResult.getMethod().getConstructorOrMethod().getMethod();
Issue issue = method.getAnnotation(Issue.class);
if (issue != null) {
Issues issues = method.getAnnotation(Issues.class);
if (issues != null) {
return Arrays.toString(issues.value())
.replace("[@io.qameta.allure.Issue(\"", "")
.replace("@io.qameta.allure.Issue(\"", "")
.replace("\")]", "")
.replace("\"),", ",");
} else if (issue != null) {
return issue.value();
} else {
return "";
Expand All @@ -279,8 +281,15 @@
public static String getTmsLinkAnnotationValue(ITestResult iTestResult) {
var method = iTestResult.getMethod().getConstructorOrMethod().getMethod();
TmsLink tmsLink = method.getAnnotation(TmsLink.class);
if (tmsLink != null) {
TmsLinks tmsLinks = method.getAnnotation(TmsLinks.class);
if (tmsLinks != null) {
return Arrays.toString(tmsLinks.value())
.replace("[@io.qameta.allure.TmsLink(\"", "")
.replace("@io.qameta.allure.TmsLink(\"", "")
.replace("\")]", "")
.replace("\"),", ",");

Check warning on line 290 in src/main/java/com/shaft/listeners/internal/TestNGListenerHelper.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/shaft/listeners/internal/TestNGListenerHelper.java#L286-L290

Added lines #L286 - L290 were not covered by tests
} else if (tmsLink != null) {
return tmsLink.value();

Check warning on line 292 in src/main/java/com/shaft/listeners/internal/TestNGListenerHelper.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/shaft/listeners/internal/TestNGListenerHelper.java#L292

Added line #L292 was not covered by tests
} else {
return "";
}
Expand Down
Loading