Skip to Content
0
Former Member
Sep 09, 2007 at 11:22 AM

ABAP Unit question

91 Views

Hello,

I am new to ABAP unit, and not really sure on how I can execute one ABAP unit test script.

Let's say I have the below code (extracted from SAPBC401_PRJD_ABAP_UNIT program in SAP ECC 6.0 system (SP9).

**&---------------------------------------------------------------------
**
**& Report  SAPBC401_PRJD_ABAP_UNIT
**&
**&---------------------------------------------------------------------
REPORT  sapbc401_prjd_abap_unit.

CLASS myclass DEFINITION.
  PUBLIC SECTION.
    CLASS-DATA text TYPE string.
    CLASS-METHODS set_text_to_x.
ENDCLASS.

CLASS myclass IMPLEMENTATION.
  METHOD set_text_to_x.
    text = 'U'.
  ENDMETHOD.
ENDCLASS.

* Test classes
CLASS mytest DEFINITION FOR TESTING.
  PRIVATE SECTION.
    METHODS mytestmethod FOR TESTING.
ENDCLASS.

CLASS mytest IMPLEMENTATION.
  METHOD mytestmethod.
    myclass=>set_text_to_x( ).
    cl_aunit_assert=>assert_equals( act = myclass=>text
                                    exp = 'X' ).
  ENDMETHOD.
ENDCLASS.

The simple question is, how I can execute the

mytestmethod

from

mytest

class?

If I just execute the above code using F8, I believe nothing is executed right?

I tried to append the below code, but it is also only executing the method in that particular class (not in the test case class).

start-of-selection.
myclass=>set_text_to_x( ).

Please help me to start...

Thanks in advanced.

rgs,

hiroshi