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

chore: use common tracker TestSetup DHIS2-19095 #20123

Merged
merged 1 commit into from
Feb 28, 2025
Merged

chore: use common tracker TestSetup DHIS2-19095 #20123

merged 1 commit into from
Feb 28, 2025

Conversation

teleivo
Copy link
Contributor

@teleivo teleivo commented Feb 28, 2025

  • use common tracker TestSetup (introduced in PR) (refer to the PR for why we have 2 duplicate TestSetup classes).
  • most tests use the same fixtures for metadata/data: so provide a default for it
  • provide setup methods to create additional metadata/data
  • there is nothing simple about our simple_metadata.json 😅 rename fixtures to
    • base_metadata.json
    • base_data.json

Next

  • remove test setup from TrackerTest and remove the entire class by moving the annotations on tests
  • add a way to pass params to import
  • base_data depends on base_metadata: so create metadata directly via setupTrackerData()?
  • can we automatically set the admin user? or should we return a custom record or so with the objectBundle, trackerObjects, admin, ...
  • make common assertions reusable we still have some duplicate code here for asserting an import was successful
  • reuse base_data.json like we did for base_metadata.json via the dhis-support-test module
  • settle on one way to set the user in our tests via testSetup.testAsUser? This ideally should live in TestBase but since we did not get any answer from platform this might be our best solution for now.

Future

We should figure out some scenarios for our testing like one or two common implementations put into our metadata/data.

  • what users/roles typically exist in a tracker implementation
  • what typical programs/stages are there
  • ...

The metadata we have right now is not really structured with the above in mind.

@teleivo teleivo marked this pull request as ready for review February 28, 2025 10:45
@teleivo teleivo enabled auto-merge (squash) February 28, 2025 10:58
Copy link

sonarqubecloud bot commented Feb 28, 2025

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@teleivo teleivo merged commit e940a88 into master Feb 28, 2025
16 checks passed
@teleivo teleivo deleted the DHIS2-19095 branch February 28, 2025 11:12
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