Skip to content
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 part of #5343: Implement script to run code coverage for a specific file #5432

Conversation

Rd4dev
Copy link
Collaborator

@Rd4dev Rd4dev commented Jun 20, 2024

Explanation

Fixes part of #5343

Project

[PR 1.3 of Project 4.1]

Changes Made

  • Added a new script utility RunCoverage.kt that takes a filename as an argument.
  • Implements handling for exempted files and test target mapping.

Implementation Details

  • Exemption Check: The script first checks if the provided file is exempted from having test file [the implemetation will be changed once PR 1.2 is merged]. If exempted, it exits early with the message "The file is exempted hence no coverage!".

  • Test Target Mapping:

    • Script, App, and Default Subpackages: Constructs mappings for files within these subpackages to their corresponding test targets.
    • App Subpackage: Handles mapping for both test and Localtests.
  • Code Coverage Execution:

    • Utilizes the RunCoverageForTestTarget script to execute code coverage analysis.
    • Returns a list of coverage data strings for each run, which will be subsequently saved as protos in PR 1.4.

Example Usage

bazel run //scripts:run_coverage -- $(pwd) utility/src/main/java/org/oppia/android/util/parser/math/MathModel.kt

Essential Checklist

  • The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

For UI-specific PRs only

If your PR includes UI-related changes, then:

  • Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes
  • For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see RTL guide)
  • Add a video showing the full UX flow with a screen reader enabled (see accessibility guide)
  • For PRs introducing new UI elements or color changes, both light and dark mode screenshots must be included
  • Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing

@Rd4dev Rd4dev requested review from a team as code owners June 20, 2024 13:57
@Rd4dev Rd4dev requested review from BenHenning and removed request for a team June 20, 2024 13:57
@Rd4dev Rd4dev changed the title Code coverage using filename Fix part of #5343: Implement script to run code coverage for a specific file Jun 20, 2024
@Rd4dev Rd4dev self-assigned this Jun 20, 2024
@Rd4dev Rd4dev closed this Jun 20, 2024
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.

1 participant