2012 Jul 31 8:24 AM
hi
i would like to know how to create ABAP unit for the developed ABAP objects?i saw in couple of sites but unable to understand the root that is if anyone have any real time specific example or any idea on this can u throw some light on this?
i was asked to prepare couple of test cases for some objects and need some inputs on this regard.
2012 Jul 31 8:45 AM
Hi Moorthy,
I once wrote a Wiki for ABAP Units
http://wiki.sdn.sap.com/wiki/display/ABAP/ABAP+Unit+Best+Practices
Please check it. The code template therein will help you to quickly start with ABAP unit test in your own code.
Hope it helps!
Rüdiger
hi
i would like to know how to create ABAP unit for the developed ABAP objects?i saw in couple of sites but unable to understand the root that is if anyone have any real time specific example or any idea on this can u throw some light on this?
i was asked to prepare couple of test cases for some objects and need some inputs on this regard.
2012 Jul 31 8:45 AM
Hi Moorthy,
I once wrote a Wiki for ABAP Units
http://wiki.sdn.sap.com/wiki/display/ABAP/ABAP+Unit+Best+Practices
Please check it. The code template therein will help you to quickly start with ABAP unit test in your own code.
Hope it helps!
Rüdiger
2012 Jul 31 8:59 AM
Hi Rüdiger
I have gone through the link. can u give me some code on how u have checked the subroutine call and other tests that u have done.
i need a scenario -so that i can start developing the same for my scenario.what and how u have checked the subroutine or other fm calls.
thanks
2012 Jul 31 9:32 AM
Hi Moorthy,
here comes a kind of hello world version, which already shows you some important things.
That's all. Easy, but very useful!
Regards,
Rüdiger
*&---------------------------------------------------------------------*
*& Report ZZ_ADD_TWO_NUMBERS
*&---------------------------------------------------------------------*
report zz_add_two_numbers.
parameters: p_first type i,
p_second type i.
start-of-selection.
perform start.
* --- Delegates the computational part to routine "add"
form start.
data: lv_result type i.
perform add using p_first p_second
changing lv_result.
write: / p_first, '+', p_second, '=', lv_result.
endform. "start
* --- Separate the computational part
form add using iv_first type i
iv_second type i
changing ev_result type i.
ev_result = iv_first + iv_second.
endform. "add
*
class lcl_test definition for testing " #AU Risk_Level Harmless
inheriting from cl_aunit_assert. " #AU Duration Short
private section.
methods test_1_plus_1 for testing.
endclass. "lcl_test DEFINITION
*
class lcl_test implementation.
*
method test_1_plus_1.
data: lv_result type i.
perform add using 1 1 changing lv_result.
assert_equals( act = lv_result
exp = 2 ).
endmethod. "test_1_plus_1
endclass. "lcl_test IMPLEMENTATION
2012 Jul 31 6:54 PM
Hi Rüdiger,
allthough this might be off topic,
I am dying to know, how you applied these nice CODE tags to your reply.
I already tried the old way ( using {code} ), but did not manage to get anything working.
The style combobox in this editor does not show a code-style, so I assume you need to do some html tricks ?
Would really appreciate a hint on how you managed that.
Thanks
Volker
2012 Aug 02 7:56 PM
Hello Volker,
I learned this from Suhas. The "syntax highlighting" is available only in the "advanced editor". Above the text editor for notes, you'll find the link "use advanced editor". Follow it and continue writing in the advanced editor. There you find a button with ">>" on it. When you click it, you find out that it is a multi-select buton. Choose "Syntax highlighting", and then "plain", since there is no syntax highlighting for ABAP yet.
I think the {code} tag still exists, but you can only use it in other areas of the SCN, like e.g. wiki's.
I am not happy with the current state:
So it continues to look non-professional.
Regards,
Rüdiger
2012 Aug 02 8:05 PM
... oh, I forgot: And the line numbering is ****, too:
2012 Aug 03 1:55 PM
Thank you very much !
How bad is that. I already checked the advanced editor, but when
"hovering" above ">>" it only said "INSERT", SO I NEVER PRESSED IT!
Guess it would be helpfull if there would be a combobox arrow like near to the "Style" button.
Have to try that ...
Gotta check that out :-)
Well, linenumbering seems to work
just duplicating lines for no reason. But I'll work on that later.
Thanks a lot 😉
Volker
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |