‎2009 Jan 21 9:02 PM
Hi,
I want to test some 10 scenario,In Every scenario 1 table is expect and 1 get for actual .
For that i want to use for every scenario the class below,
Something that i miss what happen if there is problem in table1 and in table2 the program continue and display the both problems or it exit and bring just the problem in table1.
if so there is a way to bring all the tables errors?
Regards
cl_aunit_assert=>assert_equals( exp = <table1> quit = cl_aunit_assert=>no act = table1 msg = msg ).
cl_aunit_assert=>assert_equals( exp = <table2> quit = cl_aunit_assert=>no act = table2 msg = msg ).And so on....
‎2009 Jan 21 10:41 PM
Parameter QUIT of the ASSERT_EQUALS will determine what to do after you got assertion in the CL_AUNIT_ASSERT=>ASSERT_EQUALS method.
In this below example, test execution will contine even if assertion would be raised by the first call because we have specified CL_AUNIT_ASSERT=>NO. But it will terminate the method if the second call fails because we haven't specified any this thing.
METHOD TEST_1.
...
CL_AUNIT_ASSERT=>ASSERT_EQUALS(
ACT = <a_tab1>
EXP = <e_tab1>
QUIT = CL_AUNIT_ASSERT=>NO " <<
MSG = 'Main data not matching').
CL_AUNIT_ASSERT=>ASSERT_EQUALS(
ACT = <a_tab2>
EXP = <e_tab2>
MSG = 'Main data not matching').
CL_AUNIT_ASSERT=>ASSERT_EQUALS(
ACT = <a_tab3>
EXP = <e_tab3>
QUIT = CL_AUNIT_ASSERT=>NO
MSG = 'Main data not matching').
ENDMETHOD.
Now, you should set the value of the parameter QUIT if you want to stop:
Current test Method use CL_AUNIT_ASSERT=>METHOD
Current test Class use CL_AUNIT_ASSERT=>CLASS
Current program use CL_AUNIT_ASSERT=>PROGRAM
Regards,
Naimesh Patel
‎2009 Jan 21 10:41 PM
Parameter QUIT of the ASSERT_EQUALS will determine what to do after you got assertion in the CL_AUNIT_ASSERT=>ASSERT_EQUALS method.
In this below example, test execution will contine even if assertion would be raised by the first call because we have specified CL_AUNIT_ASSERT=>NO. But it will terminate the method if the second call fails because we haven't specified any this thing.
METHOD TEST_1.
...
CL_AUNIT_ASSERT=>ASSERT_EQUALS(
ACT = <a_tab1>
EXP = <e_tab1>
QUIT = CL_AUNIT_ASSERT=>NO " <<
MSG = 'Main data not matching').
CL_AUNIT_ASSERT=>ASSERT_EQUALS(
ACT = <a_tab2>
EXP = <e_tab2>
MSG = 'Main data not matching').
CL_AUNIT_ASSERT=>ASSERT_EQUALS(
ACT = <a_tab3>
EXP = <e_tab3>
QUIT = CL_AUNIT_ASSERT=>NO
MSG = 'Main data not matching').
ENDMETHOD.
Now, you should set the value of the parameter QUIT if you want to stop:
Current test Method use CL_AUNIT_ASSERT=>METHOD
Current test Class use CL_AUNIT_ASSERT=>CLASS
Current program use CL_AUNIT_ASSERT=>PROGRAM
Regards,
Naimesh Patel
‎2009 Jan 22 8:32 AM
Hi Naimesh ,
You can elaborate on this please,
I don't sure if i understand it ,example will help.
Current test Method use CL_AUNIT_ASSERT=>METHOD
Current test Class use CL_AUNIT_ASSERT=>CLASS
Current program use CL_AUNIT_ASSERT=>PROGRAMThanks in advance .
‎2009 Jan 22 2:19 PM
These values for the parameter QUIT will determine the execution of the next test method, test class or entire program in case of the failure.
When you use QUIT = CL_AUNIT_ASSERT=>METHOD, ABAP Unit farmework will not execute any test method in the same test class if this assertion fails.
When you use QUIT = CL_AUNIT_ASSERT=>CLASS, ABAP Unit farmework will exit from current test class if this assertion fails.
I would suggest to go through this TechEd session:
Look for the section "Test Sequence of Failed Tests"
Regards,
Naimesh Patel