-
Notifications
You must be signed in to change notification settings - Fork 0
Upgrade to Java 21 (Selenium/TestNG test framework) #14
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
base: main
Are you sure you want to change the base?
Changes from all commits
4c6f10b
ca847ac
8b469da
9e32d26
4b06557
7f32b32
18d7364
1a7bf44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package example.example.listeners; | ||
|
|
||
| import org.testng.ISuite; | ||
| import org.testng.ISuiteListener; | ||
| import org.testng.ISuiteResult; | ||
| import org.testng.ITestContext; | ||
|
|
||
| import example.example.util.LoggerUtil; | ||
| import example.example.util.MailUtil; | ||
| import example.example.util.TestProperties; | ||
|
|
||
| /** | ||
| * Suite-level listener that loads global properties before the suite runs and, | ||
| * once the whole suite has finished, logs an execution summary and emails the | ||
| * report. This replaces the former {@code @BeforeSuite}/{@code @AfterSuite} | ||
| * hooks in {@code BaseTest}: TestNG 7 no longer supports native parameter | ||
| * injection into {@code @AfterSuite} methods, and a suite listener guarantees | ||
| * the summary runs exactly once per suite while aggregating results across every | ||
| * {@code <test>} tag. | ||
| */ | ||
| public class SuiteSummaryListener implements ISuiteListener { | ||
|
|
||
| @Override | ||
| public void onStart(ISuite suite) { | ||
| LoggerUtil.log("************************** Test Execution Started ************************************"); | ||
| TestProperties.loadAllPropertie(); | ||
| } | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
|
||
|
|
||
| @Override | ||
| public void onFinish(ISuite suite) { | ||
| int total = 0; | ||
| int passed = 0; | ||
| int failed = 0; | ||
| int skipped = 0; | ||
| for (ISuiteResult result : suite.getResults().values()) { | ||
| ITestContext context = result.getTestContext(); | ||
| total += context.getAllTestMethods().length; | ||
| passed += context.getPassedTests().size(); | ||
| failed += context.getFailedTests().size(); | ||
| skipped += context.getSkippedTests().size(); | ||
| } | ||
| LoggerUtil.log("Total number of testcases : " + total); | ||
| LoggerUtil.log("Number of testcases Passed : " + passed); | ||
| LoggerUtil.log("Number of testcases Failed : " + failed); | ||
| LoggerUtil.log("Number of testcases Skipped : " + skipped); | ||
| boolean mailSent = MailUtil.sendMail(total, passed, failed, skipped); | ||
| LoggerUtil.log("Mail sent : " + mailSent); | ||
| LoggerUtil.log("************************** Test Execution Finished ************************************"); | ||
| } | ||
|
|
||
| } | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: Pre-existing: driver.close() followed by driver.quit() can throw The Was this helpful? React with 👍 or 👎 to provide feedback.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed this is pre-existing ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚩 Pre-existing: spurious
x
property in pom.xmlLine 18 contains
<p>x</p>inside the<properties>block. This defines a Maven property namedpwith valuex. It's likely a leftover from debugging or testing. While it doesn't break the build, it's noise in the POM. This is pre-existing and unchanged by this PR.Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed it's harmless leftover noise (defines an unused Maven property
p=x) and, as you note, pre-existing and unchanged by this PR. Keeping this PR's diff scoped to the Java 21 / TestNG 7 / Selenium 4 upgrade, so I'm leaving it as-is here. Happy to remove it in a small follow-up cleanup if you'd like it gone.