Application Development 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: 

ABAP sample of TEST Class that works in 6.40 or at least 7.0

phil_soady
Participant
0 Kudos

I had to remove ALL of my Test classes because it caused syntax problems in certain release levels. So annoying that the syntax has changed so much since 6.40

I dont have access to 6.40 or 7.0 systems. All of out systems are 7.2, 7.4 or 7.5 NW release level.

The eclipse default template

class ltcl_ definition final for testing  duration short 
  risk level harmless.   
private section.
    methods:
      first_test for testing raising cx_static_check.
 endclass. 
class ltcl_ implementation.   
method first_test.
    cl_abap_unit_assert=>fail( 'Implement your first test here' ).   
endmethod. 
endclass.

is not valid in 7.0 NW or earlier.

Can someone share valid syntax for a AUNIT class in 7.0 please

https://help.sap.com doesnt make it easy to access older versions of help ?

1 ACCEPTED SOLUTION

horst_keller
Product and Topic Expert
Product and Topic Expert

Besides using the old cl_aunit_... classes you also have to use the old pseudo comments for duration and risk level.

"#AU Risk_Level ...
"#AU Duration ...

Or leave those additions simply away.

https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/de-DE/index.htm?file=abapclass_for_test...

5 REPLIES 5

pokrakam
Active Contributor

Going from memory, if you change all cl_abap_unit* classes to cl_aunit* it should be ok. e.g. cl_abap_unit_assert --> cl_aunit_assert

The old 7.0 cl_aunit classes are still around in newer systems, so I imagine if it compiles and runs on 7.2+ it should then also work on 7.0

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Yep, plus pseudo comments. That should do it.

0 Kudos

Thx Mike. Im ready to try AUNIT again and deliver to customers.

horst_keller
Product and Topic Expert
Product and Topic Expert

Besides using the old cl_aunit_... classes you also have to use the old pseudo comments for duration and risk level.

"#AU Risk_Level ...
"#AU Duration ...

Or leave those additions simply away.

https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/de-DE/index.htm?file=abapclass_for_test...

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

"https://help.sap.com doesnt make it easy to access older versions of help ?"

In that case you're right. As a rule, ABAP Language elements are documented in the system, not in the help portal. You need system access to see the documentation.

As a "nice to have", offline versions of the ABAP Keyword Documentation are made available in the help portal, but only from 7.30 (same as 7.02) on, sorry. Only by checking the news (in that case e.g. here), you see the changes.