[BUG]: Code coverage reports misrepresent Kotlin inline functions #5501
Labels
bug
End user-perceivable behaviors which are not desirable.
Impact: Medium
Moderate perceived user impact (non-blocking bugs and general improvements).
Work: Low
Solution is clear and broken into good-first-issue-sized chunks.
Describe the bug
When evaluating code coverage for files containing Kotlin inline functions, the coverage report inaccurately displays the coverage status. Inline functions may appear as either uninstrumented (highlighted in grey) or not covered (highlighted in red) despite being hit by test cases.
Steps To Reproduce
Examine MathExpressionParser.kt, which contains the following inline function:
Debug lines are added to assist with verifying coverage.
Execute tests on MathExpressionParserTest.kt to confirm that the inline function is hit by the test cases:
Running:
bazel test utility/src/test/java/org/oppia/android/util/math:MathExpressionParserTest --test_filter=testParseNumExp_largeRealExponent_optionalErrorsDisabled_doesNotFail
Logged:
MathExpressionParser.kt
,bazel run //scripts:run_coverage -- $(pwd) utility/src/main/java/org/oppia/android/util/math/MathExpressionParser.kt
Review the generated HTML code coverage report for
MathExpressionParser.kt
.Despite the function being executed during tests, the lines are incorrectly reported as not covered.
Raw coverage info:
To analyze the raw coverage data, run the following bazel coverage command:
coverage.dat info for the inline function lines:
Expected Behavior
The coverage report should highlight the lines in green, indicating that they are covered by the tests.
Additional Context
Most inline functions are marked as uninstrumented in the coverage report.
BundleExtensions.kt
Bazel version
6.5.0
rules_kotlin
v1.7.1
sha: fd92a98bd8a8f0e1cdcb490b93f5acef1f1727ed992571232d33de42395ca9b3
What device/emulator are you using?
No response
Which Android version is your device/emulator running?
No response
Which version of the Oppia Android app are you using?
No response
The text was updated successfully, but these errors were encountered: