Skip to content

Part Test refactor - #9928

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

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

Conversation

@SchrodingersGat

@SchrodingersGat SchrodingersGat commented Jul 1, 2025 •

Copy link
Copy Markdown
Member

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

netlify Bot commented Jul 1, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit 3439743
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6ad05694246241e68c8aaf44
😎 Deploy Preview https://deploy-preview-9928--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 92 (no change from production)
Accessibility: 82 (no change from production)
Best Practices: 92 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@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
@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 modified the milestones: 2.0.0, 1.4.0 Apr 2, 2026
@SchrodingersGat SchrodingersGat modified the milestones: 1.4.0, 2.0.0 May 21, 2026
@matmair

matmair commented Oct 12, 2026

Copy link
Copy Markdown
Member

@SchrodingersGat are you still working on this or is this something you would like someone else to work on

@SchrodingersGat

Copy link
Copy Markdown
Member Author

@SchrodingersGat are you still working on this or is this something you would like someone else to work on

still working on this

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.

3 participants