Skip to content

[FR] Test statistics #5995

Closed
Closed

Description

@martonmiklos

Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find a similar feature request

Problem statement

It would be great if statistics could be made from test results easily.
I am not only thinking about from the part perspective view like suggested in the #821, but from other, higher perspective (per test templates for e.g.) or in general (see later).

What I am thinking about:

Test failure type analysis:
As I read about the test reporting documentation I realized that we use somewhat differently the test results concepts what it was originally designed:
We run test sequences (composed from several test steps). If any of the test steps failing the sequence terminated immediately and get logged in the following manner: I store the failed step name in the value field. In the case if all steps passing a passed result will be logged w/o any value.
I do not know if this InvenTree usage approach should be follow-able, but logging each step as a separate test result would not make much sense in our case (we have looped test steps with a few K iterations for e.g.).
Anyway: it would be good if the test results count could be grouped and counted by the failure reason. If we use the value for this calculation or we introduce a failure reason field for the test run is up for discussion. The calculation could be filtered by test run date (time interval), part type or test template.

Retest statistics
Sometimes it is important to know how "smoothly" going the testing at the manufacturing floor. It would be great if the test results could include a retest field which would be zero for the first test results saved for a specific stock item for the given test template, and would be set to true in the case if the test is executed again for the same stock item. From this retest flag we can make some statistics about the retest metrics to see how stable the testing goes on the floor.

Test equipment statistics
It would be great if the test equipment information (test station number for e.g.) could be logged to each test result and some metrics could be created to see how much the specific stations are utilizeed. (See next point.)

Execution time statistics
There are tests which require operator intervention which contributes to the testing processes capacity. It would be great if the test execution time (start/stop) could be stored for each test result, and some statistics (min, max, average, distribution of the test time) could be created per test template (with filtering capability on time intervals, or specific build orders). It would be also useful to accumulate the test times grouped by test stations to see the given stations utilization.

Suggested solution

First I would like to discuss if storing more data (test time, station info, failure step) makes sense for the fellow developers. I know that our "InvenTree test adoptation" was went in a somewhat different way as InvenTree used at different places, but I think these additions would makes sense at many other users.
If we agree upon something in this area I think this is something what I can help to move forward.

I know that the timing for new UI features is not the best at the moment (in the meantime of the UI switching), however for my own usage at first I do not need web UI: I would like to create a daily/weekly test statistics digest e-mail which would be created by an external tool with the usage of the InvenTree API.

The API design/discussion/implementation is something what I think I could be capable to help with.

Describe alternatives you've considered

Examples of other systems

I am not aware of any.

Do you want to develop this?

  • I want to develop this.

Activity

  1. added
    enhancement
    triage:not-checked
    on Nov 27, 2023
  2. added
    build
    and removed
    triage:not-checked
    on Dec 6, 2023
  3. SchrodingersGat commented on Dec 6, 2023

    @SchrodingersGat
    Member

    @martonmiklos some very interesting ideas here, it aligns somewhat with our proposed expansion of MES functionality.

    Some of the particulars here would be good as a plugin, but there is certainly room for expansion and improvement on the existing functionality. The stock item testing framework has received very little development over the last couple of years.

    First I would like to discuss if storing more data (test time, station info, failure step) makes sense for the fellow developers.

    This could be added in the metadata for the test result itself, as there may be a wide range of data that different companies want to implement. However if there are some generic data which we can agree would be generally useful, happy to add those in.

    It would be great if the test results could include a retest field which would be zero for the first test results saved for a specific stock item for the given test template, and would be set to true in the case if the test is executed again for the same stock item.

    The existing implementation keeps all recorded test results, so you can already determine how many pass / fail results there are against a particular test case. Unless I am misreading this?


    In general, I am very keen to expand functionality here and provided some measure of statistical analysis would be a great feature. If you have some specific implementation ideas that you want to suggest (in terms of fields, API access, etc) then I'd suggest making a PR proposal and we can work from there?

  4. martonmiklos commented on Dec 6, 2023

    @martonmiklos
    ContributorAuthor

    The existing implementation keeps all recorded test results, so you can already determine how many pass / fail results there are against a particular test case. Unless I am misreading this?

    Yes, but I would like to "cache" the retest flag to being able to query it effectively. i.e. if I want to make a retest statistics from the past let's say 2 months (10 parts, 3000 test results) then it is just a matter of a count in SQL. If it is not cached then we would need to go through on each stock item, count the individual results per test template etc...

    If you have some specific implementation ideas that you want to suggest (in terms of fields, API access, etc) then I'd suggest making a PR proposal and we can work from there?

    Sounds like a plan!

    I missed one thing what was in my mind previously: the test status view for a build output:

    This would be a view where the test templates would be listed for the part and for each test template the tested/passed/failed/retested count would be shown for a given build order. With this view we could easily get an overview of the build outputs progressing on the tests.

  5. github-actions commented on Feb 5, 2024

    @github-actions
    Contributor

    This issue seems stale. Please react to show this is still important.

  6. added
    inactive
    on Feb 5, 2024
  7. martonmiklos commented on Feb 5, 2024

    @martonmiklos
    ContributorAuthor

    Not stale

  8. removed
    inactive
    on Feb 6, 2024
  9. github-actions commented on Apr 6, 2024

    @github-actions
    Contributor

    This issue seems stale. Please react to show this is still important.

  10. added
    inactive
    on Apr 6, 2024
  11. martonmiklos commented on Apr 6, 2024

    @martonmiklos
    ContributorAuthor

    I am still working on it

  12. removed
    inactive
    on Apr 8, 2024
  13. martonmiklos commented on Apr 11, 2024

    @martonmiklos
    ContributorAuthor

    Hi @SchrodingersGat @matmair

    I started to implement new API endpoints for generating a pass/fail statistic table broken down by part, build and test template.

    As the test results are belong under the stock I added the following API endpoints:
    https://github.com/martonmiklos/InvenTree/blob/add_test_statistics/InvenTree/stock/api.py#L1765

    I added stock/test-statistics/[by-part/by-build/by-test-template] endpoints.

    What do you think about this approach?
    Shall I move the first two API endpoints to part/build?

    On the other hand I am struggling with the filtering: I would like to get the test statistics to be filterable by date.
    I tried to try out everything here:
    https://github.com/martonmiklos/InvenTree/blob/add_test_statistics/InvenTree/stock/api.py#L1360

    But the filtering UI did not got available in the rest UI:
    kép
    neither the url filtering worked.

    I do not even know that the approach what I am trying to do is the correct way to implement.
    The actual "result matrix" generation is done here:
    https://github.com/martonmiklos/InvenTree/blob/add_test_statistics/InvenTree/stock/models.py#L2421

    I appreciate any feedback!

  14. 24 remaining items

  15. added a commit that references this issue on May 8, 2024
    2e08a3c
  16. added 3 commits that reference this issue on May 16, 2024
    28d447d
    09ea7d9
    d3cc966
  17. added 2 commits that reference this issue on Jun 24, 2024
    a066d89
    915f50b
  18. added a commit that references this issue on Jul 3, 2024
    ebd47b7
  19. github-actions commented on Jul 5, 2024

    @github-actions
    Contributor

    This issue seems stale. Please react to show this is still important.

  20. added
    inactive
    on Jul 5, 2024
  21. SchrodingersGat commented on Jul 5, 2024

    @SchrodingersGat
    Member

    Not stale

  22. added this to the 0.16.0 milestone on Jul 5, 2024
  23. added a commit that references this issue on Jul 31, 2024
    3cbfcc1
  24. added a commit that references this issue on Jul 31, 2024
    0d71aae
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildenhancementinactive

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions