Skip to content

Part Test refactor#9928

Draft
SchrodingersGat wants to merge 27 commits intoinventree:masterfrom
SchrodingersGat:test-refactor
Draft

Part Test refactor#9928
SchrodingersGat wants to merge 27 commits intoinventree:masterfrom
SchrodingersGat:test-refactor

Conversation

@SchrodingersGat
Copy link
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
  • Allow individual tests to be turned on / off (separate to the template)
  • 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
  • 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
  • Prevent duplicate PartTest entries for the same PartCategory
  • 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

@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

netlify bot commented Jul 1, 2025

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

Name Link
🔨 Latest commit c3d9d01
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/69a6b9746bd94300083c6a67

@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
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
@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

❌ Patch coverage is 60.50955% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.73%. Comparing base (948818b) to head (c3d9d01).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9928      +/-   ##
==========================================
- Coverage   88.05%   87.73%   -0.33%     
==========================================
  Files        1296     1299       +3     
  Lines       59025    59150     +125     
  Branches     1935     1926       -9     
==========================================
- Hits        51974    51893      -81     
- Misses       6570     6776     +206     
  Partials      481      481              
Flag Coverage Δ
migrations 41.75% <60.50%> (-0.27%) ⬇️

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

Components Coverage Δ
Backend Apps 91.13% <60.25%> (-0.58%) ⬇️
Backend General 93.37% <ø> (ø)
Frontend 71.01% <ø> (+0.09%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 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.

1 participant