-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: Allow LooperMode annotation on nested tests and test methods #59
Conversation
WalkthroughThe recent updates aim to refine Robolectric's testing framework by adjusting annotation usage, enhancing synchronization in test execution, and improving looper management. Changes include clarifying limitations in the Changes
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- README.md (1 hunks)
- robolectric-extension/src/main/kotlin/tech/apter/junit/jupiter/robolectric/internal/JUnit5RobolectricSandboxManager.kt (2 hunks)
- robolectric-extension/src/main/kotlin/tech/apter/junit/jupiter/robolectric/internal/JUnit5RobolectricTestRunner.kt (1 hunks)
- robolectric-extension/src/main/kotlin/tech/apter/junit/jupiter/robolectric/internal/JUnit5RobolectricTestRunnerHelper.kt (1 hunks)
- robolectric-extension/src/main/kotlin/tech/apter/junit/jupiter/robolectric/internal/SandboxExtensions.kt (1 hunks)
- robolectric-extension/src/main/kotlin/tech/apter/junit/jupiter/robolectric/internal/validation/TestClassValidator.kt (2 hunks)
- robolectric-extension/src/test/kotlin/tech/apter/junit/jupiter/robolectric/RobolectricExtensionLooperModeSelfTest.kt (1 hunks)
- robolectric-extension/src/test/kotlin/tech/apter/junit/jupiter/robolectric/RobolectricExtensionSelfTest.kt (1 hunks)
Files skipped from review due to trivial changes (1)
- robolectric-extension/src/main/kotlin/tech/apter/junit/jupiter/robolectric/internal/validation/TestClassValidator.kt
Additional Context Used
LanguageTool (4)
README.md (4)
Near line 18: Possible missing comma found.
Context: ...* Parallel Execution: Parallel test execution only experimentally supported with clas...
Near line 21: You might be missing the article “the” here.
Context: ...icsMode` annotations can only be set on outermost test class. * Experimental Status: ...
Near line 123: You might be missing the article “the” here.
Context: ...our test methods. You could also useorg.jetbrains.kotlin:kotlin-test-junit5
...
Near line 123: This phrasing can be overused. Try elevating your writing with a more formal alternative.
Context: ...ains.kotlin:kotlin-test-junit5` package if you want to.Kotlin</summa...
Additional comments not posted (7)
robolectric-extension/src/main/kotlin/tech/apter/junit/jupiter/robolectric/internal/SandboxExtensions.kt (2)
44-47
: Ensure proper exception handling for reflection use inclearShadowLooperCache
.Reflection is used to clear the looper cache. Consider wrapping this in a try-catch block to handle potential
ClassNotFoundException
,NoSuchMethodException
, orInvocationTargetException
that might arise from reflection operations.
49-52
: Ensure proper exception handling for reflection use inresetLooper
.Reflection is used to reset the main and thread-specific loopers. Consider wrapping this in a try-catch block to handle potential reflection-related exceptions.
robolectric-extension/src/test/kotlin/tech/apter/junit/jupiter/robolectric/RobolectricExtensionLooperModeSelfTest.kt (1)
1-84
: Tests are well-structured and effectively use the new@LooperMode
annotations.The tests in
RobolectricExtensionLooperModeSelfTest.kt
are comprehensive and well-organized, effectively testing the new functionality related toLooperMode
annotations on nested classes and methods.robolectric-extension/src/main/kotlin/tech/apter/junit/jupiter/robolectric/internal/JUnit5RobolectricTestRunnerHelper.kt (1)
59-59
: Change aligns with modifications in the main test runner to ensure correct context passing.The addition of the
this
reference in therunFinallyAfterTest
method call ensures that the correct sandbox environment is used for cleanup, aligning with the architectural changes made in the main test runner.robolectric-extension/src/main/kotlin/tech/apter/junit/jupiter/robolectric/internal/JUnit5RobolectricTestRunner.kt (2)
61-62
: Enhanced logging inrunBeforeTest
improves visibility of test execution.The addition of a logging statement in the
runBeforeTest
method enhances the visibility and traceability of the test execution process, aiding in debugging and monitoring.
70-74
: Enhanced cleanup inrunFinallyAfterTest
ensures correct test environment reset.The inclusion of
clearShadowLooperCache
andresetLooper
in therunFinallyAfterTest
method ensures that the test environment is correctly reset after each test, enhancing the reliability and consistency of the testing process.README.md (1)
18-21
: Clarify the experimental support for parallel test execution and restrictions on annotations.The updates in the
README.md
file clearly explain the experimental support for parallel test execution and the restrictions on setting certain annotations only on the outermost test class. However, consider adding a comma after "execution" in line 18 and inserting "the" before "outermost test class" in line 21 for grammatical correctness.- Parallel test execution only experimentally supported with classes. + Parallel test execution, only experimentally supported with classes. - annotations can only be set on outermost test class. + annotations can only be set on the outermost test class.
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- robolectric-extension/src/main/kotlin/tech/apter/junit/jupiter/robolectric/internal/JUnit5RobolectricTestRunner.kt (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- robolectric-extension/src/main/kotlin/tech/apter/junit/jupiter/robolectric/internal/JUnit5RobolectricTestRunner.kt
Line Coverage
|
Summary by CodeRabbit
LooperMode
settings to verify thread behavior in a Robolectric test environment.