Skip to content

Part Test refactor#9928

Draft
SchrodingersGat wants to merge 58 commits into
inventree:masterfrom
SchrodingersGat:test-refactor
Draft

Part Test refactor#9928
SchrodingersGat wants to merge 58 commits into
inventree:masterfrom
SchrodingersGat:test-refactor

Conversation

@SchrodingersGat
Copy link
Copy Markdown
Member

@SchrodingersGat SchrodingersGat commented Jul 1, 2025

This PR represents a major overhaul of the testing framework in preparation for the 1.0.0 release.

Prior to this change, the PartTestTemplate model was linked to a specific part. So if the user wanted to assign the "same" test to another part (say in a different category) then the template had to be duplicated.

The major change here is to decouple the PartTestTemplate model from the Part model - templates are now generic and can be reused. We then add the PartTest model which links a template to either a Part or PartCategory instance.

Link to Part

If a template is linked to a given part, then test results can be generated for any stock item of that part (or any variants of that part).

Link to Category

If a template is linked to a given category then test results can be generated for any part which lives under that category.

TODO

  • Schema and data migrations
  • Add migration testing
  • Specific migration testing for consolidating duplicate templates
  • Fix reverse migration issues
  • Fix data fixtures for part tests
  • Add API endpoints for new PartTest model
  • Add data tables for viewing / editing / deleting the PartTest instances against a part
  • Add function to determine the tests associated with a given part
  • Add API endpoints for filtering PartTest by "part" instance (including inheritance from parent part or category)
  • Update UI logic for viewing available tests against a given part
  • Update UI logic for viewing available tests against a build order
  • Update UI logic for viewing available tests against a stock item
  • Fix "copy_tests_from" function on a Part instance
  • Fix "copy test_results_from" function on a StockItem instance.
  • Ensure test results are copied when serializing a stock item
  • Ensure test results map / list / etc are properly available in a report template
  • Fix existing unit tests
  • Add new playwright tests
  • Add new API unit tests
  • Update CHANGELOG.md
  • Update documentation around testing procedures
  • Update demo dataset (data migration)
  • Prevent duplicate PartTest entries for the same Part
  • Allow override of tests based on part category levels
  • Ensure correct order of operations for API filters on the PartTest endpoint - the for_part filter must apply first!1
  • Allow certain parts to "exclude" tests which are inherited from above - perhaps a new model required here

@SchrodingersGat SchrodingersGat added part Related to Part models stock Related to Stock models api Relates to the API breaking Indicates a major update or change which breaks compatibility migration Data or schema migrations User Interface Related to the frontend / User Interface full-run Always do a full QC CI run labels Jul 1, 2025
@netlify
Copy link
Copy Markdown

netlify Bot commented Jul 1, 2025

Deploy Preview for inventree-web-pui-preview failed.

Name Link
🔨 Latest commit 22973e4
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a05c96774a8410008b9bf51

@SchrodingersGat SchrodingersGat marked this pull request as draft July 1, 2025 14:17
@SchrodingersGat SchrodingersGat added this to the 1.0.0 milestone Jul 1, 2025
Comment thread src/frontend/src/tables/part/PartTestTable.tsx Fixed
Comment thread src/frontend/src/tables/part/PartTestTable.tsx Fixed
@SchrodingersGat SchrodingersGat modified the milestones: 1.0.0, 1.1.0 Jul 23, 2025
@SchrodingersGat
Copy link
Copy Markdown
Member Author

Bumping to the next release target, a lot to think about here which I don't have time for

@SchrodingersGat SchrodingersGat modified the milestones: 1.1.0, 2.0.0 Oct 20, 2025
@SchrodingersGat SchrodingersGat modified the milestones: 2.0.0, 1.3.0 Feb 12, 2026
@SchrodingersGat SchrodingersGat added the report Report/Label generation label Mar 26, 2026
@SchrodingersGat SchrodingersGat modified the milestones: 2.0.0, 1.4.0 Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API breaking Indicates a major update or change which breaks compatibility full-run Always do a full QC CI run migration Data or schema migrations part Related to Part models report Report/Label generation stock Related to Stock models User Interface Related to the frontend / User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants