10-08-2014 10:32 PM
Hey ABAPers,
I know how to run all of our unit tests using Code Inspector and it reports if any failed and how many 'programs' have been tested. However, I can't seem to find an easy way to determine exactly how many unit test methods we have in our system. We are on NW 7.0...
If anyone knows an easy way to determine how many unit tests are in the system I would love to know!
Thanks,
Lucas
10-09-2014 8:19 AM
10-09-2014 8:19 AM
10-09-2014 4:19 PM
I had a look but the scirest_ps tables only contain details about failed unit tests and some statistics that don't really make sense to me...
10-09-2014 4:21 PM
After you suggested that I realized that Code Inspector obviously has a way to find these unit tests... Once I found the class that it uses to find the tests it was pretty easy to come up with a number. I just ran it for Z* objects but we could also open it up to look for all unit tests on any objects.
REPORT zz_how_many_unit_tests.
DATA: lt_tadir TYPE STANDARD TABLE OF tadir,
prog_info TYPE if_aunit_prog_info_types=>ty_s_program,
count TYPE i.
FIELD-SYMBOLS: <tadir> TYPE tadir,
<testclass> TYPE if_aunit_prog_info_types=>ty_s_testclass,
<test> TYPE if_aunit_prog_info_types=>ty_s_method.
SELECT object obj_name
INTO CORRESPONDING FIELDS OF TABLE lt_tadir
FROM tadir
WHERE obj_name LIKE 'Z%'
AND object IN ('CLAS','FUGR').
LOOP AT lt_tadir ASSIGNING <tadir>.
prog_info = cl_aunit_prog_info=>get_program_info( obj_name = <tadir>-obj_name
obj_type = <tadir>-object
allow_commit = abap_true
skip_class_info = abap_false ).
LOOP AT prog_info-testclasses ASSIGNING <testclass>.
LOOP AT <testclass>-methods ASSIGNING <test>.
ADD 1 TO count.
ENDLOOP.
ENDLOOP.
ENDLOOP.
WRITE: / 'You have ', count, ' unit tests.'.
10-09-2014 4:25 PM
Thanks for sharing!
i already copied it and since the customer is thinking about choosing between ATC, CAST and others performance tools and this can help as starting point