Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show current progress of tests run #117

Open
pesse opened this issue Dec 7, 2018 · 5 comments
Open

Show current progress of tests run #117

pesse opened this issue Dec 7, 2018 · 5 comments

Comments

@pesse
Copy link
Member

pesse commented Dec 7, 2018

If you run a larger set of tests it might be useful to indicate the current progress (n of m tests run) in the active console line (if Output is System.out),

This should not have any effect on the printed lines, though.

@jgebal
Copy link
Member

jgebal commented Dec 9, 2018

This can be done within reporter.
Reporter gets whole suite before run starts.
The big quiestion is, should it be part of reporter ir part of API.

Should it be always enabled or optional?
If we want it always enabled, we can add it into documentation reporter.

@pesse
Copy link
Member Author

pesse commented Dec 11, 2018

Does Reporter know when a test is finished? Does it even know which test is currently running?

I could imagine to add some new function to reporter API:

  • get_current_progress: Returns type containing number of tests, number of run tests and percentage (optional)
  • get_current_test: Returns the package/name of the test currently running (if possible)

Would give a great way to increase user-feedback

@jgebal
Copy link
Member

jgebal commented Dec 11, 2018

Reporters don't provide any get_ functionality. They are data-agnostic.
They only provide stream of output text/data in specified format.
Reporters are not interactive in that sence.

@pesse
Copy link
Member Author

pesse commented Dec 11, 2018

utPLSQL/utPLSQL#795 might be sufficient as input to consume

@PhilippSalvisberg
Copy link
Member

@pesse: you may initialize the new ut_realtime_reporter in the producer thread (as you do it already for other reporters) and consume the events you are interested in an additional thread for example this way:

select x.test_number, x.total_number_of_tests, x.utplsql_path
  from table(ut_output_table_buffer('7E45E66B02651B74E053020011AC0687').get_lines()) t,
       xmltable(
         '/event/test'
         passing xmltype(t.text)
         columns test_number           integer        path 'testNumber',
                 total_number_of_tests integer        path 'totalNumberOfTests',
                 utplsql_path          varchar2(1000) path '@id'
       ) x
 where t.item_type = 'pre-test';

In SQL*Plus I get a result like this:

TEST_NUMBER TOTAL_NUMBER_OF_TESTS UTPLSQL_PATH                                                                                                  
----------- --------------------- --------------------------------------------------------------------------------------
          1                   731 utplsql.core.test_ut_utils.trim_list_elements.test_trim_list_elements                                         
          2                   731 utplsql.core.test_ut_utils.trim_list_elements.trim_list_elemts_null_collect                                   
          3                   731 utplsql.core.test_ut_utils.trim_list_elements.trim_list_elemts_empty_collect                                  
          4                   731 utplsql.core.test_ut_utils.to_string.to_string_emptyblob                                                      
...
        728                   731 utplsql.api.test_ut_run.run_proc_transaction_control.run_proc_keep_test_data_raise                            
        729                   731 utplsql.api.test_ut_run.run_proc_transaction_control.run_proc_discard_test_data                               
        730                   731 utplsql.api.test_ut_run.ut_version                                                                            
        731                   731 utplsql.api.test_ut_run.ut_fail                                                                               

731 rows selected. 

You get an event (output row) exactly before a new test is executed. Based on that, showing progressing information should be simple.

See PR #809 for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants