2015 Mar 20 12:20 AM
I have the following test program that I'm trying to run with ABAP Unit Test Runner from Eclipse ADT.
It does work when executed from SAPGui SE38, but on Eclipse it does not show any test method (see atached image).
ADT version 2.41.1
SAP NetWeaver AS ABAP 7.31 Trial
My test code is:
REPORT z_calc.
CLASS zut_calc DEFINITION FOR TESTING.
PUBLIC SECTION.
METHODS test_add FOR TESTING.
ENDCLASS.
CLASS zut_calc IMPLEMENTATION.
METHOD test_add.
DATA: lv_act TYPE i.
lv_act = 1 + 3.
cl_aunit_assert=>assert_equals( act = lv_act
exp = 4 ).
ENDMETHOD.
ENDCLASS.
Thanks.
2015 Mar 20 10:55 AM
Hi Guilherme,
you need to add a message.
Have a look here, that is a really good point to start with
Here is your method completed. Hope this gives you the clues you need.
~Florian
CLASS zut_calc DEFINITION FOR TESTING . "#AU Risk_Level Harmless "#AU Duration Short .
PUBLIC SECTION.
METHODS test_add FOR TESTING.
ENDCLASS.
CLASS zut_calc IMPLEMENTATION.
METHOD test_add.
DATA: lv_act TYPE i.
lv_act = 1 + 3.
cl_aunit_assert=>assert_equals( act = lv_act
exp = 5
msg = 'incorrect').
ENDMETHOD.
ENDCLASS.
I have the following test program that I'm trying to run with ABAP Unit Test Runner from Eclipse ADT.
It does work when executed from SAPGui SE38, but on Eclipse it does not show any test method (see atached image).
ADT version 2.41.1
SAP NetWeaver AS ABAP 7.31 Trial
My test code is:
REPORT z_calc.
CLASS zut_calc DEFINITION FOR TESTING.
PUBLIC SECTION.
METHODS test_add FOR TESTING.
ENDCLASS.
CLASS zut_calc IMPLEMENTATION.
METHOD test_add.
DATA: lv_act TYPE i.
lv_act = 1 + 3.
cl_aunit_assert=>assert_equals( act = lv_act
exp = 4 ).
ENDMETHOD.
ENDCLASS.
Thanks.
2015 Mar 20 10:55 AM
Hi Guilherme,
you need to add a message.
Have a look here, that is a really good point to start with
Here is your method completed. Hope this gives you the clues you need.
~Florian
CLASS zut_calc DEFINITION FOR TESTING . "#AU Risk_Level Harmless "#AU Duration Short .
PUBLIC SECTION.
METHODS test_add FOR TESTING.
ENDCLASS.
CLASS zut_calc IMPLEMENTATION.
METHOD test_add.
DATA: lv_act TYPE i.
lv_act = 1 + 3.
cl_aunit_assert=>assert_equals( act = lv_act
exp = 5
msg = 'incorrect').
ENDMETHOD.
ENDCLASS.
2015 Mar 20 11:02 AM
Hi,
For risk level and duration, it's depreciated to use the pseudocomments.
From the SAP Help:
Rgds,
Jeroen
2015 Mar 20 12:02 PM
Thank you for your reponse, but it still does not work. I added the msg parameter and tried with both pseudo comments and with additions RISK LEVEL and DURATION.
It does work as expected in SE38, but not in Eclipse ADT.
2015 Mar 20 1:11 PM
2015 Mar 20 1:38 PM
There is no error, it just does not find any test method. Look at the screenshot attached to my first post.
2015 Mar 20 8:31 PM
Hi Guilherme,
I just recognized the Release yet. I think you are just not high enough with your release to us this function in eclipse:
I'm not pretty sure, but I think the Unit-test is part of the profile-function and this is available at 7.4 SP2 or higher. My System ( HANA 7.40 SP10) everything works fine with the completed code above.
~Florian
Have a look here