-
Notifications
You must be signed in to change notification settings - Fork 78
task(SDK-4889): Ignore UI related classes from unit test coverage #824
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: develop
Are you sure you want to change the base?
Conversation
Add Android Studio run configuration to include tests from all modules and ignore the same files as setup in the jacoco gradle plugin
WalkthroughA new Gradle run configuration for running all unit tests across multiple modules was added, with detailed class/package exclusions for coverage reporting. The Jacoco coverage exclusion patterns in the Gradle script were updated to remove generic patterns and add targeted exclusions for Clevertap SDK components. The Gradle JVM heap size was increased from 4 GB to 8 GB. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant Gradle
participant TestModules
participant Jacoco
Developer->>Gradle: Run "All Tests" configuration
Gradle->>TestModules: Execute test tasks for core, geofence, hms, pushtemplates
TestModules-->>Gradle: Return test results
Gradle->>Jacoco: Generate coverage report with new exclusion patterns
Jacoco-->>Gradle: Coverage report (excluding specified classes)
Gradle-->>Developer: Display test and coverage results
Suggested reviewers
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Code Coverage Debug
|
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: 1
🧹 Nitpick comments (2)
gradle-scripts/jacoco_root.gradle (1)
35-75
: Refactor detailed CT ignore patterns into package-level wildcards
The extensive list of individual exclusions for Clevertap internal classes can be consolidated for readability and maintainability. For example, replace multiple entries like:'com/clevertap/android/sdk/customviews/**', 'com/clevertap/android/sdk/inapp/CTInAppHtmlFooterFragment*.*', 'com/clevertap/android/sdk/inbox/CTInboxMessageAdapter*.*',with broader wildcards:
-ext.excludes += [ - 'com/clevertap/android/sdk/customviews/**', - 'com/clevertap/android/sdk/inapp/**', - 'com/clevertap/android/sdk/inbox/**', - 'com/clevertap/android/geofence/**', - 'com/clevertap/android/hms/**', - 'com/clevertap/android/pushtemplates/**' -] +ext.excludes += [ + 'com/clevertap/android/sdk/**', + 'com/clevertap/android/geofence/**', + 'com/clevertap/android/hms/**', + 'com/clevertap/android/pushtemplates/**' +].run/All Tests.run.xml (1)
33-262
: Centralize coverage exclusion lists to avoid drift
The IDE run-configuration’s exclusion patterns largely duplicatejacoco_root.gradle
. Consider generating one from the other or extracting into a shared snippet so updates stay in sync.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.run/All Tests.run.xml
(1 hunks)gradle-scripts/jacoco_root.gradle
(1 hunks)gradle.properties
(1 hunks)
🔇 Additional comments (2)
gradle.properties (1)
5-5
: Increase Gradle JVM heap size to 8 GB
Raising the-Xmx
may boost build/test performance but verify that all CI agents and developer machines have the necessary RAM to avoid OOM errors..run/All Tests.run.xml (1)
12-24
: Verify Gradle test filtering syntax
The<taskNames>
list splits--tests
and the quoted patterns ("com.clevertap.android.sdk.*"
) into separate XML entries. Please confirm IntelliJ will invoke:gradlew :clevertap-core:testDebugUnitTest --tests com.clevertap.android.sdk.*
as intended, otherwise test filters may be ignored.
<option name="PATTERN" value="com.clevertap.android.*" /> | ||
<option name="ENABLED" value="true" /> | ||
</pattern> |
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.
Missing INCLUDE
flag on final coverage pattern
The last pattern for com.clevertap.android.*
only specifies ENABLED
but omits <option name="INCLUDE" value="false"/>
, which is required to exclude it.
🤖 Prompt for AI Agents
In the file .run/All Tests.run.xml around lines 259 to 261, the final coverage
pattern for com.clevertap.android.* is missing the INCLUDE flag. Add the option
<option name="INCLUDE" value="false"/> inside the pattern element to explicitly
exclude this pattern as intended.
Add Android Studio run configuration to include tests from all modules and ignore the same files as setup in the jacoco gradle plugin
Summary by CodeRabbit