‎2009 Oct 06 1:20 PM
Hello Experts ,
In se24 I am creating the class for tesing BUT when I try to test byclicking on UNIT TEST .
It gives message :-
NO EXECUTION AS ACTUAL RISCK LEVEL IS TOO HIGH
CAN U HELP ME IN SOLVING THIS PROBLEM ?
-
class's PUBLIC SECTION IS AS FOLLOW .
class ZUNITTESTCLASS98 definition
public
final
create public
for testing "#AU Risk_Level HARMLESS
.
" public components of class ZUNITTESTCLASS98
" do not include other source files here!!!
public section.
-
PRIVATE SECTION
private section.
methods CHECK_REFERNCE
for testing .
-
CODE FOR THE METHOD :-
method CHECK_REFERNCE.
DATA OBJ1 TYPE REF TO ZWDCSOPERATION98 .
CREATE OBJECT OBJ1.
FIELD-SYMBOLS <TAB1> TYPE STANDARD TABLE .
DATA REF1 TYPE REF TO DATA .
CALL METHOD OBJ1->GET_TABLE
EXPORTING
TAB_NAME = 'SFLIGHT'
RECEIVING
R_TABLE = REF1
.
CALL METHOD CL_AUNIT_ASSERT=>ASSERT_BOUND
EXPORTING
ACT = REF1
MSG = 'REFERENCE IS NOT POINTING TO ANYVALID DATA '
LEVEL = CRITICAL
QUIT = METHOD
RECEIVING
ASSERTION_FAILED =
.
endmethod.
-
‎2009 Oct 06 2:29 PM
While using the class builder, try not to change the definition manually. You can set the Risk Level, to Harmless in the Properties tab. Since this #AU is the pseudo comment, it must be like "Harmless", not HARMLESS.
class ZCL_TEST_NP_TEST definition
public
abstract
create public
for testing
"#AU Risk_Level Harmless
.
You would not be able to perform the Unit test (from menu Program > Unit Test) on this test class. You need to create a local test class inheriting from this global test class in the production class (class on which you want to perform the test). Please refer to these discussions:
Regards,
Naimesh Patel
‎2009 Oct 06 2:29 PM
While using the class builder, try not to change the definition manually. You can set the Risk Level, to Harmless in the Properties tab. Since this #AU is the pseudo comment, it must be like "Harmless", not HARMLESS.
class ZCL_TEST_NP_TEST definition
public
abstract
create public
for testing
"#AU Risk_Level Harmless
.
You would not be able to perform the Unit test (from menu Program > Unit Test) on this test class. You need to create a local test class inheriting from this global test class in the production class (class on which you want to perform the test). Please refer to these discussions:
Regards,
Naimesh Patel
‎2009 Oct 07 4:55 AM
‎2009 Nov 12 12:45 PM
Hi Rushi,
I am new to oops concept but i am able to understand.
Now i have to create some Unit test plans in ABAP.We are using SAP Netwever 7.1 and WEB AS 6.0
I tried from SE24 but i couldn't get the correct path.
Can you please explain me: if i have a Z program then where and how to write a number of Unit test classes. And how it will integrate to with our actual program/FM/any object
Thanks
Umashankar.