ABAPu3000Unit'su3000coverage
Hi all
I had written a test code of abap, it is for test a form of abap pgm.
Now , I want to know the percent of coverage about this test code. How should I do.
For example:
This is my abap pgm.
FORM GET_LFG USING VALUE(L_AGE) TYPE N
CHANGING L_FLG TYPE N
IF L_AGE > 60.
L_FLG = 1.
ELSEIF L_AGE >= 40 AND L_AGE <= 60.
L_FLG = 2.
ELSE.
L_FLG = 3.
ENDIF.
ENDFORM.
This is my test code.
CLASS lcl_test DEFINITION
CLASS LCL_TEST DEFINITION FOR TESTING "#AU Duration Short
INHERITING FROM CL_AUNIT_ASSERT. "#AU Risk_Level Harmless
PRIVATE SECTION.
METHODS TEST_GET_LFG_SIMPLE_CALL FOR TESTING.
ENDCLASS. "lcl_test DEFINITION
CLASS lcl_test IMPLEMENTATION
CLASS LCL_TEST IMPLEMENTATION.
METHOD TEST_GET_LFG_SIMPLE_CALL.
Setup parameters for the call...
DATA :
L_AGE(2) TYPE N,
L_FLG TYPE N.
Perform the call
L_AGE = 61.
PERFORM GET_AGE USING L_AGE
CHANGING L_FLG.
Check returned values
ASSERT_EQUALS( ACT = L_FLG EXP = 1 MSG = 'ERROR FOR OVER 60 YEARS' ).
Perform the call
L_AGE = 55.
PERFORM GET_AGE USING L_AGE
CHANGING L_FLG.
Check returned values
ASSERT_EQUALS( ACT = L_FLG EXP = 2 MSG = 'ERROR FOR FORM 40 TO 60 YEARS' ).
ENDMETHOD. "TEST_GET_GLE_SIMPLE_CALL
ENDCLASS. "lcl_test IMPLEMENTATION
The test code just check two cases. the other case(<40) is not be tested.
thanks
ljz
Hello Lhz,
from netweaver release 7.02 onwards unit test execution with combined coverage measurement is integrated into the IDE (transaction SE80). For the older releases these are seperate tools. In case you are in your development system the follwoing approach may help.
Any code change to your report will also reset any coverage measurement (TA SCOV).
After a change execute your unit tests and review the effects in transaction SCOV. Please note that SCOV needs to be switch on explictely and that the so called data collection of SCOV happens not event based but on regular schedule. This can delay the arrival of your actions in the coverage results.
Kind Regards
Klaus
Similar Messages
Maybe you are looking for
-
Problem while partitioning The Table
create table Employee ( empno number(3), name varchar2(10), deptno number(4)) partition by range(deptno) (partition p1 values less than(11), partition p2 values less than(21), partition p3 values less than(31)); create table Employee ( ERROR at line
-
Customer contact functionality not working as expected
Good day, i'm new here, just joined today because of this problem i'm having. I created a Promise-to-Pay on 18.07.2011 to be paid on 28.07.2011 The problem is that it still appears in the Open Items Worklist when i run udm_supervisor under the specif
-
Windows 7 Home Premium and ASUS Motherboard
I have a ASUS A8V-XE Motherboard I was running Window's XP Home. Now that I have switch to Window's I can not install the motherboard driver's so I have no sound and not sure what else is not working I'm real not pc smart. I tried to install my mothe
-
Cisco Codec 20 disconnected every 15minutes
Hi Cisco Expert, We have an issue on our C20 where the video calls were disconnected exactly every 15 minutes. Here is the logs that we have encountered: 2015-02-25T08:21:45.238+08:00 ppc eventlog[2731]: Warning (H323MCS-0:Disconnecting): Unexpected
-
Is Family sharing available on the desktop? If so how do I set it up?
I have family sharing set up with me and my wife and its working great. I can't find anyway to set this up on our laptops. Seems silly not be able to share there as well.