Skip to Content
0

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

Jul 12, 2017 at 09:16 AM

65

avatar image

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 ?

10 |10000 characters needed characters left characters exceeded

"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.

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Horst Keller
Jul 12, 2017 at 09:29 AM
1

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_testing.htm

Share
10 |10000 characters needed characters left characters exceeded
Mike Pokraka Jul 12, 2017 at 09:27 AM
2

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Yep, plus pseudo comments. That should do it.

0

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

0