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

Configure PDF Generation #3278

Merged
merged 28 commits into from
Jul 29, 2024
Merged

Configure PDF Generation #3278

merged 28 commits into from
Jul 29, 2024

Conversation

FikriMilano
Copy link
Collaborator

@FikriMilano FikriMilano commented May 20, 2024

IMPORTANT: Where possible all PRs must be linked to a Github issue

Fixes #3235

Engineer Checklist

  • I have written Unit tests for any new feature(s) and edge cases for bug fixes
  • I have added any strings visible on UI components to the strings.xml file
  • I have updated the CHANGELOG.md file for any notable changes to the codebase
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the project's style guide
  • I have built and run the FHIRCore app to verify my change fixes the issue and/or does not break the app
  • I have checked that this PR does NOT introduce breaking changes that require an update to Content and/or Configs? If it does add a sample here or a link to exactly what changes need to be made to the content.

Code Reviewer Checklist

  • I have verified Unit tests have been written for any new feature(s) and edge cases
  • I have verified any strings visible on UI components are in the strings.xml file
  • I have verifed the CHANGELOG.md file has any notable changes to the codebase
  • I have verified the solution has been implemented in a configurable and generic way for reuseable components
  • I have built and run the FHIRCore app to verify the change fixes the issue and/or does not break the app

@FikriMilano FikriMilano requested a review from ellykits May 20, 2024 00:09
@FikriMilano FikriMilano self-assigned this May 20, 2024
@FikriMilano
Copy link
Collaborator Author

For reviewers: I recommend you to review #3258 and #3259 first before reviewing this PR

@FikriMilano
Copy link
Collaborator Author

This PR has missing changes from #3258 and #3259, once those 2 are merged, and pulled to this branch, the error should disappear.

@pld
Copy link
Member

pld commented Jun 27, 2024

can we add some docs in this PR?

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 21.21212% with 52 lines in your changes missing coverage. Please review.

Project coverage is 28.1%. Comparing base (7e7cffa) to head (809595e).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main   #3278     +/-   ##
=========================================
- Coverage     28.1%   28.1%   -0.1%     
- Complexity     718     719      +1     
=========================================
  Files          265     267      +2     
  Lines        12885   12948     +63     
  Branches      2317    2324      +7     
=========================================
+ Hits          3630    3641     +11     
- Misses        8778    8827     +49     
- Partials       477     480      +3     
Flag Coverage Δ
engine 64.8% <40.0%> (-0.1%) ⬇️
quest 4.9% <19.6%> (+0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...gine/configuration/workflow/ApplicationWorkflow.kt 0.0% <0.0%> (ø)
...martregister/fhircore/quest/ui/pdf/PdfGenerator.kt 94.1% <91.6%> (ø)
...ircore/engine/configuration/QuestionnaireConfig.kt 78.5% <50.0%> (-1.3%) ⬇️
...fhircore/quest/util/extensions/ConfigExtensions.kt 0.0% <0.0%> (ø)
...ster/fhircore/quest/ui/pdf/PdfLauncherViewModel.kt 0.0% <0.0%> (ø)
...ister/fhircore/quest/ui/pdf/PdfLauncherFragment.kt 3.3% <3.3%> (ø)

@FikriMilano FikriMilano force-pushed the 3235-configure-pdf-generation branch from c332737 to dc1484e Compare June 28, 2024 12:42
@FikriMilano
Copy link
Collaborator Author

FikriMilano commented Jul 1, 2024

Remaining todos:

  • Fix test
  • Write documentation

@FikriMilano
Copy link
Collaborator Author

FikriMilano commented Jul 3, 2024

For some reason, codecov does not detect the coverage from roboelectric test, in this case for: PdfLauncherFragment.
I'll try to re-run the CI.

@pld
Copy link
Member

pld commented Jul 3, 2024

For some reason, codecov does not detect the coverage from roboelectric test, in this case for: PdfLauncherFragment. I'll try to re-run the CI.

@ndegwamartin do you have comments on this?

@FikriMilano
Copy link
Collaborator Author

The same issue might also happen on main, the coverage went from 60% to 28%

@ndegwamartin
Copy link
Contributor

Codecov shows only minimal coverage for that class on your PR , see - PR 3278 on CodeCov

@fikri when you run the jacocoTestReport locally does the class show all or most of the areas as covered? We can use this to determine whether it is a Jacoco issue, Codecov issue or maybe a CI issue.

@ndegwamartin
Copy link
Contributor

@FikriMilano here's the command that CI runs:

./gradlew clean :quest:fhircoreJacocoReport --stacktrace -Pandroid.testInstrumentationRunnerArguments.notPackage=org.smartregister.fhircore.quest.performance

@FikriMilano
Copy link
Collaborator Author

@ndegwamartin after running the command, the terminal gave me these, not sure what it means.

> Task :quest:fhircoreJacocoReport
[ant:jacocoReport] Classes in bundle 'quest' do not match with execution data. For report generation the same class files must be used as at runtime.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/appsetting/AppSettingActivity does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingInsightScreenKt does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/profile/ProfileViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel$saveDraftQuestionnaire$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/launcher/GeoWidgetLauncherViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$login$1$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/pdf/PdfLauncherViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/pin/PinLoginActivity does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/ConfigDownloadWorker does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/QuestXFhirQueryResolver does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/register/RegisterViewModel$applicationConfiguration$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingInsightScreenKt$UserSettingInsightScreen$2$1$9 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingInsightScreenKt$UserSettingInsightScreen$2$1$7 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/appsetting/AppSettingViewModel$loadConfigurations$1$1$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingInsightScreenKt$UserSettingInsightScreen$2$1$5 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingInsightScreenKt$UserSettingInsightScreen$2$1$4 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1$1$locationIds$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1$1$careTeam$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/AccountAuthenticator does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingFragment does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/appsetting/AppSettingViewModel$fetchRemoteConfigurations$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/register/RegisterPagingSource does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingInsightScreenKt$UserSettingInsightScreen$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/AuthAndroidService does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/profile/ProfileFragment does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/pin/PinViewModel$pinLogin$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/QuestApplication$initSentryMonitoring$sentryConfiguration$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/register/RegisterViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/DataMigration does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/main/AppMainViewModel$countRegisterData$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/register/RegisterViewModel$retrieveRegisterUiState$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/ConfigDownloadWorker$doWork$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireActivity does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel$handleQuestionnaireSubmission$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/main/AppMainViewModel$applicationConfiguration$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1$1$organizationIds$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingScreenKt$UserSettingScreen$3 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/report/measure/MeasureReportRepository does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingFragment$onCreateView$1$1$2$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModel$fetchUnsyncedResources$1$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/main/AppMainViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1$1$location$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireActivity$fetchLocation$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserInsightScreenFragment does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingScreenKt does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1$1$organization$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginActivity does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/util/extensions/LifecycleExtensionsKt$hookSnackBar$3 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/QuestConfigService does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/main/AppMainActivity does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/util/extensions/ComposeExtensionsKt does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel$performExtraction$2$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/appsetting/AppSettingViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/QuestApplication does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/report/measure/MeasureReportSubjectsPagingSource does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/report/measure/MeasureReportViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/pdf/PdfLauncherFragment does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1$1$careTeamIds$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireActivity$renderQuestionnaire$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/report/measure/models/MeasureReportIndividualResult$$serializer does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/pin/PinViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/pdf/PdfLauncherFragment$onCreate$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/report/measure/MeasureReportPagingSource does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/register/RegisterFragment does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/util/extensions/ConfigExtensionsKt does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/report/measure/MeasureReportRepository$evaluatePopulationMeasure$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/ComposableSingletons$UserSettingInsightScreenKt$lambda-5$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$login$1 does not match.

BUILD SUCCESSFUL in 13m 5s

@ndegwamartin
Copy link
Contributor

@ndegwamartin after running the command, the terminal gave me these, not sure what it means.

> Task :quest:fhircoreJacocoReport
[ant:jacocoReport] Classes in bundle 'quest' do not match with execution data. For report generation the same class files must be used as at runtime.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/appsetting/AppSettingActivity does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingInsightScreenKt does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/profile/ProfileViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel$saveDraftQuestionnaire$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/launcher/GeoWidgetLauncherViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$login$1$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/pdf/PdfLauncherViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/pin/PinLoginActivity does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/ConfigDownloadWorker does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/QuestXFhirQueryResolver does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/register/RegisterViewModel$applicationConfiguration$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingInsightScreenKt$UserSettingInsightScreen$2$1$9 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingInsightScreenKt$UserSettingInsightScreen$2$1$7 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/appsetting/AppSettingViewModel$loadConfigurations$1$1$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingInsightScreenKt$UserSettingInsightScreen$2$1$5 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingInsightScreenKt$UserSettingInsightScreen$2$1$4 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1$1$locationIds$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1$1$careTeam$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/AccountAuthenticator does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingFragment does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/appsetting/AppSettingViewModel$fetchRemoteConfigurations$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/register/RegisterPagingSource does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingInsightScreenKt$UserSettingInsightScreen$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/AuthAndroidService does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/profile/ProfileFragment does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/pin/PinViewModel$pinLogin$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/QuestApplication$initSentryMonitoring$sentryConfiguration$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/register/RegisterViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/DataMigration does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/main/AppMainViewModel$countRegisterData$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/register/RegisterViewModel$retrieveRegisterUiState$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/ConfigDownloadWorker$doWork$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireActivity does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel$handleQuestionnaireSubmission$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/main/AppMainViewModel$applicationConfiguration$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1$1$organizationIds$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingScreenKt$UserSettingScreen$3 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/report/measure/MeasureReportRepository does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingFragment$onCreateView$1$1$2$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingViewModel$fetchUnsyncedResources$1$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/main/AppMainViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1$1$location$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireActivity$fetchLocation$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserInsightScreenFragment does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/UserSettingScreenKt does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1$1$organization$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginActivity does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/util/extensions/LifecycleExtensionsKt$hookSnackBar$3 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/QuestConfigService does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/main/AppMainActivity does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/util/extensions/ComposeExtensionsKt does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel$performExtraction$2$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/appsetting/AppSettingViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/QuestApplication does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/report/measure/MeasureReportSubjectsPagingSource does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/report/measure/MeasureReportViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/pdf/PdfLauncherFragment does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$savePractitionerDetails$1$1$careTeamIds$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireActivity$renderQuestionnaire$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/report/measure/models/MeasureReportIndividualResult$$serializer does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/pin/PinViewModel does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/pdf/PdfLauncherFragment$onCreate$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/report/measure/MeasureReportPagingSource does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/register/RegisterFragment does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/util/extensions/ConfigExtensionsKt does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/data/report/measure/MeasureReportRepository$evaluatePopulationMeasure$2 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/usersetting/ComposableSingletons$UserSettingInsightScreenKt$lambda-5$1 does not match.
[ant:jacocoReport] Execution data for class org/smartregister/fhircore/quest/ui/login/LoginViewModel$login$1 does not match.

BUILD SUCCESSFUL in 13m 5s

@FikriMilano I think is just a warning. Did you inspect the generated HTML coverage report and determine whether it has(or doesn't have) the code coverage?

@FikriMilano
Copy link
Collaborator Author

FikriMilano commented Jul 11, 2024

@ndegwamartin here's the coverage from my local jacoco. We can say that it's not covering the PdfLauncherFragment by much.

Is my test the problem or is it jacoco?
It's quite odd though, before the test, I tried to put some logs in the PdfLauncherFragment code, to see whether the test can pass certain code lines, and after the test is complete, I found that all logs got triggered i.e. the test has passed those code lines.

Btw, we have all tests as test module, instead of androidTest.

Screen Shot 2024-07-11 at 10 51 47

@ndegwamartin
Copy link
Contributor

@FikriMilano could you click on the PdfLauncherFragment class link on the report. Maybe screenshot that as well?

@FikriMilano
Copy link
Collaborator Author

@ndegwamartin here's the screenshots (my test logs was able to reach line 108, starting from onCreate):
Screen Shot 2024-07-12 at 17 13 00
Screen Shot 2024-07-12 at 17 14 05

@ndegwamartin
Copy link
Contributor

Yeah so according to Jacoco the onCreate function and the getQuestionnaireConfig methods are not tested while generatePDF is partially tested, hence the 9% coverage shown for the PDFLauncherFragment class

@ndegwamartin
Copy link
Contributor

The IDE also has a Run test with Coverage feature, when you run that, does it report approximately the same coverage for your branch ?

Screenshot 2024-07-12 at 16 48 16

@FikriMilano
Copy link
Collaborator Author

FikriMilano commented Jul 15, 2024

The coverage is 0%. Also, If I run it that way, the test fails and gives this exception.
I'll just rewrite the test without Roboelectric, no worries.

Screen Shot 2024-07-15 at 10 16 12
java.lang.VerifyError: Bad return type
Exception Details:
  Location:
    android/content/res/ResourcesImpl.$$robo$$android_content_res_ResourcesImpl$loadComplexColorForCookie(Landroid/content/res/Resources;Landroid/util/TypedValue;ILandroid/content/res/Resources$Theme;)Landroid/content/res/ComplexColor; @838: areturn
  Reason:
    Type 'java/lang/Object' (current frame, stack[0]) is not assignable to 'android/content/res/ComplexColor' (from method signature)
  Current Frame:
    bci: @838
    flags: { }
    locals: { 'android/content/res/ResourcesImpl', 'android/content/res/Resources', 'android/util/TypedValue', integer, 'android/content/res/Resources$Theme', '[I', '[Z', 'java/lang/String', 'java/lang/Object', 'android/content/res/XmlResourceParser', 'android/util/AttributeSet', integer, 'java/lang/String' }
    stack: { 'java/lang/Object' }
at android.content.res.Resources.__constructor__(Resources.java:220)
	at android.content.res.Resources.<init>(Resources.java)
	at org.robolectric.shadows.ShadowResources.getSystem(ShadowResources.java:86)
	at android.content.res.Resources.getSystem(Resources.java)
	at org.robolectric.android.internal.RoboMonitoringInstrumentation.onCreate(RoboMonitoringInstrumentation.java:74)
	at org.robolectric.android.internal.AndroidTestEnvironment.createInstrumentation(AndroidTestEnvironment.java:582)
	at org.robolectric.android.internal.AndroidTestEnvironment.setUpApplicationState(AndroidTestEnvironment.java:205)
	at org.robolectric.RobolectricTestRunner.beforeTest(RobolectricTestRunner.java:340)
	at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$2(SandboxTestRunner.java:281)
	at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:99)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

@FikriMilano
Copy link
Collaborator Author

FikriMilano commented Jul 26, 2024

As discussed w @ndegwamartin
We've found that Roboelectric tests in Quest are not reported to jacoco, including these new ones I wrote. Also happens to the main branch. But the tests themself, able to verifies correctly depending on it's parameter.

So, we'll merge this PR first, then fix the jacoco test report issue in a different PR.
#3055

cc @pld

@pld
Copy link
Member

pld commented Jul 26, 2024

Sounds good let's merge once passing

@ndegwamartin ndegwamartin merged commit 5fcc4a0 into main Jul 29, 2024
4 of 5 checks passed
@ndegwamartin ndegwamartin deleted the 3235-configure-pdf-generation branch July 29, 2024 13:52
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.

Configure PDF Generation
3 participants