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 Unit?

Private_Member_49934
Contributor
0 Kudos

Dear Mentors!

I have been hunting to find a a good start with SAP Unit.

What ever I find, on wiki or on google shows, say, how to test 2+2 or 3*5. I don't find any post showing how to use it, say abap report, where it is not so easy to determine the expected result. All the data is fetched form database, How do i test it?

I am really hopeful that someone will come forward with help!

Thanks in advance!

2 REPLIES 2

alex_campbell
Contributor
0 Kudos

In order to use ABAP Unit effectively, you need to write your program from the start in a style that makes it possible to Unit Test. For the database issue specifically, look up dependency injection (you can google it i'm sure). In short, it's a way to define all your test data in the unit test, and for the unit test only use this test data instead of selecting against the database. Here's an ABAP-specific blog post on dependency injection:

http://scn.sap.com/people/stephen.pfeiffer/blog/2010/08/23/managing-dependencies-in-tdd-private-inje...

There's a term for the larger concept of developing your program in such a way. It's called Test-Driven Development. You can google that term and find a bunch of information. Here's a link to get you started (but it's a big topic, so I suggest spending some type surfing the web):

http://www.g3it.com/blog/technical/abap/adopting-test-driven-development-using-abap-unit/

amy_king
Active Contributor
0 Kudos

Hi Kumar,

Check out the sections "ABAP Test Cockpit" and "ABAP Unit" in this document,

Cheers,

Amy