Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

No test methods found on ABAP Unit Runner

Former Member
0 Likes
2,016

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.

1 ACCEPTED SOLUTION
Read only

Florian
SAP Champion
SAP Champion
1,711

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.

6 REPLIES 6
Read only

Florian
SAP Champion
SAP Champion
1,712

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.

Read only

0 Likes
1,711

Hi,

For risk level and duration, it's depreciated to use the pseudocomments.

From the SAP Help:

  • A risk level must be defined for SAP test classes.

  • The additions RISK LEVEL and DURATION replace the pseudo comments for test classes. Existing pseudo comments are not ignored, but should no longer be used.

Rgds,

Jeroen

Read only

Former Member
0 Likes
1,711

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.

Read only

0 Likes
1,711

What error do you get in Abap Unit Runner in Eclipse?

Read only

Former Member
0 Likes
1,711

There is no error, it just does not find any test method. Look at the screenshot attached to my first post.

Read only

Florian
SAP Champion
SAP Champion
0 Likes
1,711

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