This repository contains utility classes, listeners, aspects, and services for generating and managing test reports.
This repository includes the following components:
com.reports.utils.logging
: Contains theLogManager
class for managing logging operations.com.reports.utils.listeners
: Includes listeners (TestListener
andXrayListener
) for handling TestNG test events.com.reports.utils.aspects
: Contains an aspect (LoggingAspect
) for aspect-oriented logging.com.reports.utils.spark
: Contains classes for setting up ExtentReports with Spark for generating HTML reports.com.reports.utils.xray
: Includes theXrayService
class for interacting with the Xray API to send test reports to Jira Xray.com.reports.utils.slack
: Includes theSlackService
class for interacting with the Slack API to send test reports to Slack.com.reports.utils.email
: Includes theEmailService
class to send test reports by email.pom.xml
: Contains configurations for setting up Allure Reports for generating HTML reports.
- Clone the repository:
git clone https://github.com/cmccarthyIrl/testng-reporting-utilities
-
Add the necessary dependencies to your project build file.
-
Use the provided classes, listeners, aspects, and services in your test automation framework.
mvn test -Dsuite=suite
The LogManager
class provides methods for logging at different levels (info, debug, warn, error).
TestListener
: Listens to TestNG test events and logs test start, success, failure, and skip.XrayListener
: Listens to TestNG test events and integrates with Xray for reporting test results.
The LoggingAspect
class provides aspect-oriented logging for methods annotated with @Action
or @Step
.
The SparkReporter
class sets up ExtentReports with Spark for generating HTML reports. It includes configurations for the report theme, title, timeline, and operating system information.
The framework is configured to automatically generate Allure reports to target/allure-results
From the root folder testng-reporting-utilities
execute mvn allure:serve
The XrayService
class provides methods for interacting with the Xray API to send test reports to Jira Xray. It handles authentication, test report import, and error handling.
The EmailService
class handles sending emails with test execution results.
The SlackService
class provides methods for interacting with the Slack API to send test reports to Slack .
Refer to the specific components' sections above for usage examples and configuration details.
Contributions to enhance the functionality or improve the code are welcome! Feel free to open issues or pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.