SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software Kodyaz Development Resources
Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.

Software Development



Develop Better Code by Writing Testable Code

I have enrolled openSAP course "'Writing Testable Code for ABAP" and completed the first week of this very useful 6 week long course.
The first week is an Introduction to ABAP Unit Testing
The best part is in the first week ABAP programmers could complete two hands-on exercises on developing ABAP unit tests which provides a fast intro to unit testing on ABAP environment using Eclipse as development environment.

I just want to put some of my notes here to share with ABAP developers who are interested in learning unit test development

Some acronyms for test developers to keep in mind:
FIRST => Fast, Independent, Repeatable, Self-validating, Timely
KISS => Keep It Simple, Stupid
DRY => Don't Repeat Yourself

Try to keep naming rules for the name of the object you are aiming to test.
Use CUT_ prefix at least which means "Code Under Test" for the instance object you are testing
Always follow a testing story which can be expressed by "Given, When and Then"

I also want to share the test pyramid which expresses efforts/coverage vs. cost/runtime visually to highlight the importance of unit testing for your ABAP developments.

And here are two quotes emphasizing the importance of testing:

"There are no tricks to writing tests, there are only tricks to writing testable code." by Miško Hevery

"If the tests are good, then the product code is probably good enough.
If tests are bad or do not exist, then all hope is lost." by Gerard Meszaros

Published Monday, March 19, 2018 10:05 AM
Filed Under: , ,

Comments

No Comments
Anonymous comments are disabled

About eralper

SQL Server administrator and T-SQL developer including BI components Web programming with HTML, HTML5 and ASP, ASP.NET and .NET Framework developer SAP ABAP and SAPUI5 development, Web Dynpro and Smart Form Siemens HiPath Center CTI development
Copyright © 2004 - 2018 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems