Improve test data creation #112

Merged
niat8586 merged 8 commits from test-data-improvements into develop 2025-03-03 12:38:36 +01:00
Owner

Currently there is only one class used to add test data; DataInitializer. That class is already very large and causes a lot of merge conflicts when multiple changes are in the pipeline as noted by #109.

This change makes it possible to have multiple classes adding test data so that each change adds its own class and thus there are no conflicts. It also has the benefit of making each class smaller and more self-contained for testing a specific feature.

Some additional infrastructure was added in the form of the BaseData and Factory (naming improvements notwithstanding) interfaces to help each class add its own test data and re-use common data.

Finally all test data related classes have been moved to their own module so they can be properly excluded when building for production but are included by default while developing.

Fixes #109

Future work

  • Add a mechanism to work with date and time.
    Many processes (and therefore service method implementations) rely on the time between certain events. For example a final seminar must be scheduled a set amount of days in advance. In the ideal world, the test data is populated using these service methods to more accurately represent an achievable real world state. Therefore there must be a way to manipulate time when adding test data.
  • Add more methods to the Factory interface as we discover more common steps that many populators must take.
  • Add more base data available through the BaseData interface as we discover more common data that many populators need
    Care must be taken that this data is final and useful in its base state since populators will rely on that state.
Currently there is only one class used to add test data; [`DataInitializer`](https://gitea.dsv.su.se/DMC/scipro/src/commit/b9f7dd5a49aeebd64a5f44b66ac0775901550476/core/src/main/java/se/su/dsv/scipro/DataInitializer.java). That class is already very large and causes a lot of merge conflicts when multiple changes are in the pipeline as noted by #109. This change makes it possible to have multiple classes adding test data so that each change adds its own class and thus there are no conflicts. It also has the benefit of making each class smaller and more self-contained for testing a specific feature. Some additional infrastructure was added in the form of the `BaseData` and `Factory` (naming improvements notwithstanding) interfaces to help each class add its own test data and re-use common data. Finally all test data related classes have been moved to their own module so they can be properly excluded when building for production but are included by default while developing. Fixes #109 ## Future work * Add a mechanism to work with date and time. Many processes (and therefore service method implementations) rely on the time between certain events. For example a final seminar must be scheduled a set amount of days in advance. In the ideal world, the test data is populated using these service methods to more accurately represent an achievable real world state. Therefore there must be a way to manipulate time when adding test data. * Add more methods to the `Factory` interface as we discover more common steps that many populators must take. * Add more base data available through the `BaseData` interface as we discover more common data that many populators need Care must be taken that this data is final and useful in its base state since populators will rely on that state.
ansv7779 added 4 commits 2025-02-17 15:59:39 +01:00
There will be a lot more test data infrastructure in the future so moving it all to a separate module makes sense.
Document how to add new test data populators
Some checks failed
Deploy to branch.dsv.su.se / deploy (pull_request) Failing after 1m21s
Build and test / build-and-test (push) Successful in 17m48s
c17af42dc9
ansv7779 force-pushed test-data-improvements from c17af42dc9 to e7d6698c11 2025-02-25 10:12:37 +01:00 Compare
ansv7779 added 3 commits 2025-02-25 12:49:56 +01:00
Add Maven output of new test-data module to .gitignore
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 2m59s
Build and test / build-and-test (push) Successful in 15m59s
dd82a46fe1
ansv7779 changed title from WIP: Improve test data creation to Improve test data creation 2025-02-27 12:20:36 +01:00
Owner

@ansv7779 Should we tag the branch as WIP ?

@ansv7779 Should we tag the branch as WIP ?
niat8586 added 1 commit 2025-03-03 08:00:56 +01:00
Merge branch 'develop' into test-data-improvements
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m15s
Build and test / build-and-test (push) Successful in 15m58s
Remove branch deployment from branch.dsv.su.se / cleanup (pull_request) Successful in 5s
88d811c465
niat8586 approved these changes 2025-03-03 12:38:16 +01:00
niat8586 merged commit a76b317b1c into develop 2025-03-03 12:38:36 +01:00
niat8586 deleted branch test-data-improvements 2025-03-03 12:38:37 +01:00
Sign in to join this conversation.
No description provided.