-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix issue #857 #860
base: master
Are you sure you want to change the base?
Fix issue #857 #860
Conversation
@coderabbitai review |
WalkthroughThe modifications introduce a comprehensive test infrastructure to address an issue where test failures upon retries were not correctly invoking the Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (4)
- src/test/java/test/retryAnalyzer/RetryAnalyzerTest.java (2 hunks)
- src/test/java/test/retryAnalyzer/github857/GitHub857Listener.java (1 hunks)
- src/test/java/test/retryAnalyzer/github857/GitHub857Retry.java (1 hunks)
- src/test/java/test/retryAnalyzer/github857/GitHub857Sample.java (1 hunks)
Additional comments: 7
src/test/java/test/retryAnalyzer/github857/GitHub857Retry.java (1)
- 6-18: The retry logic in
GitHub857Retry
is straightforward and correctly implements theIRetryAnalyzer
interface. The use of a static final variable forMAX_RETRY_COUNT_PER_TEST
and a non-static variable forretryCountPerTest
is appropriate. The logic to incrementretryCountPerTest
and returntrue
orfalse
based on the comparison withMAX_RETRY_COUNT_PER_TEST
is correct.src/test/java/test/retryAnalyzer/github857/GitHub857Sample.java (2)
- 14-18: The
beforeTest
method correctly sets a custom retry analyzer for all test methods in the context. This ensures that the retry logic is applied consistently across tests.- 21-24: The
test
method intentionally fails to facilitate testing of the retry mechanism and listener interaction. This is a valid approach for testing the described functionality.src/test/java/test/retryAnalyzer/github857/GitHub857Listener.java (2)
- 13-24: The use of synchronized lists for storing test results is appropriate for thread safety. This ensures that the listener can correctly handle concurrent test execution scenarios.
- 26-51: The overridden methods (
onTestSuccess
,onTestFailure
,onTestSkipped
,onTestFailedButWithinSuccessPercentage
,onTestStart
) correctly capture and log test events. The use ofSystem.out.println
for logging in a test context is acceptable, though in a production scenario, a more robust logging framework would be preferred.src/test/java/test/retryAnalyzer/RetryAnalyzerTest.java (2)
- 15-16: The imports for
GitHub857Listener
andGitHub857Sample
are correctly added to facilitate the new test method that verifies the retry mechanism and listener interaction.- 40-60: The test method
onTestFailureShouldBeCalledWhenTestIsRetried
correctly sets up aTestNG
instance with theGitHub857Sample
class, adds aTestListenerAdapter
, and runs the test. The assertions effectively validate the expected behavior of the retry mechanism and listener interaction, ensuring thatonTestFailure
is called as expected during a retry. The use ofGitHub857Listener
's static lists to assert the outcomes is appropriate for this test scenario.
Fix #857
Summary by CodeRabbit
New Features
Tests