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

Test Coverage for multi module Android app #434

Open
sudansh opened this issue Jun 28, 2020 · 3 comments
Open

Test Coverage for multi module Android app #434

sudansh opened this issue Jun 28, 2020 · 3 comments
Assignees

Comments

@sudansh
Copy link

sudansh commented Jun 28, 2020

I am using Jacoco to produce test results for multi module app. The modular structure for example is
app/src/main/java
module1/src/main/java
module2/src/main/java...
In the test coverage recent report, I could only see the files under app/src/main/java being tracked. How could I combine all modules?

@io-timeout
Copy link

Possibly related to #376

@scottyab
Copy link

scottyab commented Dec 21, 2020

@sudansh The cc-test-reporter tool supports summing the coverage files from multi repositories. We have 3 modules /app /api and /data. We call format-coverage for each of the jacoco.xml report files then sum-coverage. Note this is extracted form Travis.yml file.

Don't know if it's expected or if there's a better way but I found we have to set the JACOCO_SOURCE_PATH environment var before formatting the coverage.


- export JACOCO_SOURCE_PATH=api/src/main/java/
  - ./cc-test-reporter format-coverage ./api/build/reports/jacoco/release/jacoco.xml --input-type jacoco -o coverage.api.json
  - export JACOCO_SOURCE_PATH=app/src/main/java/
  - ./cc-test-reporter format-coverage ./app/build/reports/jacoco/myFlavourRelease/jacoco.xml --input-type jacoco -o coverage.app.json
  - export JACOCO_SOURCE_PATH=data/src/main/java/
  - ./cc-test-reporter format-coverage ./data/build/reports/jacoco/release/jacoco.xml --input-type jacoco -o coverage.hstml.json

  # sum the modules
  - ./cc-test-reporter sum-coverage coverage.*.json -p 3 -o codeclimate.total.json
  - ./cc-test-reporter upload-coverage -i codeclimate.total.json

@trietbui-zalora
Copy link

I wonder why do we need to specify export JACOCO_SOURCE_PATH=app/src/main/java/? Does the ./api/build/reports/jacoco/release/jacoco.xml already has enough info about it?

WollfieGitHub added a commit to LEuLuDyHa/app that referenced this issue Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants