14.01.2020 Views

ABAP_to_the_Future

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Unit Testing 2.9

So, you can imagine my delight when I wa s playing around in one of the latest

SAP releases and was in SE80 and had typed in half of my program name and

pressed (F4) by reflex. I had not even put in a wild card asterisk, but what should

I see but a dropdown list of results (Figure 2.3).

Figure 2.3 F4 Search Help in SE80: Working at Long Last

Mere words cannot explain how happy this made me. It must be true that little

things please little minds. It turns out that this is available as of release 7.31—but

not everyone knows about it, so it’s worth calling out here.

2.9 Unit Testing

Chapter 3 of this book is going to talk about unit testing in some detail. Here, you

will look at three areas in which the new features in ABAP 7.40 make unit testing

just that little bit easier. Specifically, yo u’ll learn how to create mock classes in

which the original class implemented an interface, how to code the contents of a

test method faster, and how to create complicated mock objects with fewer lines

of code.

2.9.1 Creating Test Doubles Relating to Interfaces

As you’ll recall from Section 2.7.3, interface methods can now be made optional,

so you do not have to redefine them. The same change has been made to the definition

and implementation of test classes, but here the syntax is a little different.

Prior to 7.4, you would have to crea te an empty implem entation for every

131

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!