Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How many unit tests in our system?

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

SimoneMilesi
Active Contributor
0 Kudos

Did you checked SCIREST* tables?

4 REPLIES 4

SimoneMilesi
Active Contributor
0 Kudos

Did you checked SCIREST* tables?

0 Kudos

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

0 Kudos

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

0 Kudos

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