Skip to content

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

vasct
Copy link
Contributor

@vasct vasct commented Jun 6, 2025

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

  • Chores
    • Added a new run configuration to execute all unit tests across multiple modules.
    • Updated test coverage exclusions to focus on specific internal SDK classes.
    • Increased Gradle JVM maximum heap size for improved build performance.

Add Android Studio run configuration to include tests from all modules
and ignore the same files as setup in the jacoco gradle plugin
Copy link
Contributor

coderabbitai bot commented Jun 6, 2025

Walkthrough

A 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

File(s) Change Summary
.run/All Tests.run.xml Added a Gradle run configuration for executing all unit tests with specific coverage exclusions.
gradle-scripts/jacoco_root.gradle Updated Jacoco coverage exclusions: removed generic patterns, added targeted Clevertap exclusions.
gradle.properties Increased Gradle JVM max heap size from 4 GB to 8 GB.

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
Loading

Suggested reviewers

  • CTLalit
  • Anush-Shand

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Jun 6, 2025

Code Coverage Debug

Metric (instruction) Coverage Threshold Δ Coverage Status
Overall 60.52% 75.0% +9.68%
Changed Files 0.0% 75.0% 0.0%
Report Coverage (O/Ch) Threshold (O/Ch) Δ Coverage (O/Ch) Status (O/Ch)
clevertap-core 60.98% / 0.0% 75.0% / 75.0% +7.83% / 0.0% ❌/✅
clevertap-pushtemplates 42.88% / 0.0% 75.0% / 75.0% +19.14% / 0.0% ❌/✅

@vasct vasct marked this pull request as ready for review June 6, 2025 13:57
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 duplicate jacoco_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

📥 Commits

Reviewing files that changed from the base of the PR and between aaf4f79 and 4c115ab.

📒 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 (&quot;com.clevertap.android.sdk.*&quot;) 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.

Comment on lines +259 to +261
<option name="PATTERN" value="com.clevertap.android.*" />
<option name="ENABLED" value="true" />
</pattern>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants