Speed up regression tests with the ABAP debugger

Speed up your regression tests with the ABAP debugger -

A.Regression testing:
Regression testing mean is to compare the result a piece of software is giving before and after changes were made to the source-code.
Sustainable development meets the customer requirement no unwanted changes of existing behavior.. The regression tests are part of sustainable development, because they should fail, if enhancements or refactoring's break existing behavior.

B.Unit-tests:
The Unit-tests can be executed as regression tests..
Before they can be executed, values must be assigned to input parameters, & to the parameters of the test doubles and to the expected results (test data).

C.How to determine the test-data:
IF source-code is already covered by unit-tests or mainly free of technical debts, this is quite a simple task. But things getting difficult, if nobody developed unit-tests before, test-data unknown and the source-code contains high technical debts. First approach we can set a breakpoints at the point where the input parameters and the parameters of the dependencies which we want to replace with test-doubles, or the actual results are visible. When we are reaching the breakpoint in the ABAP debugger, export-function for the values of the input parameters, for the values of the dependency-parameters, or for the values of the actual results would be nice. So with this export function, we can use the values as test-data for the unit tests.

There are actually few solutions, that provide such an export function. 3 of them, I want to present you in this blog post:

1. Export to local files
A table-viewer comes with a built-in function to export table contents as tab-delimited-text-files,  as xml files or as spreadsheet-calculation-files..

 

It is very simple, to the create parsers for tab-delimited-text-files and for xml-files & for this reason lot of solutions are possible.. Even for the spreadsheet-calculation-files (Excel) solutions like abap2xlsx were implemented.
An approved solution is mockup-loader project, which can be used to import the tab delimited-text files or Excel-files.

One disadvantage is missing connection to transport-system, when the files are stored in the filesystem..

2. Generate code-snippets with the VALUE-operator
Alexander Geppart presented another idea in his blog-post. Alexander Geppart implemented ABAP debugger enhancements, which were creating code-snippets, that fill the test-data.

Test data is then we directly placed in the test class which can be a pro & a con. Its an advantage for tiny structures & tables. Huge structures & tables causes long and confusing test-methods & then it’s a con.

3. Export to ecatt-test-data-containers
This solution is based on the idea that, to let debugger-scripts fill ecatt-test-data-containers with the current values of the visible local or global variables.. The solution can be found under open-source-license at github.
Main advantage of the possibility to export and import a complete set of variables at one time, then the direct connection to the version-control and transport system.
Finally the ecatt-test-data-containers can be simple edited in the SAP-GUI.

D.Further use-cases for the export functions
On further use-case i see for sensing variables.
The Sensing variables were a idea of Micheal Feathers, which he presented in-his blog and they are useful to preserve existing behavior. Feathers idea was to use unit test, that fail in the first step and show the actual values of the sensing variables. Instead of using unit test, it would be quite simpler to use the above export function for value determination of sensing variables.

E.Conclusion
I hope the export function presented in this blog can help you to manage the huge structures or huge internal tables in your regression tests.

Thank you everyone.

Comments

Popular posts from this blog

EVENTS IN INTERACTIVE REPORTS OF SAP ABAP

Differences Between Classic & New BAdIs :

SAP ABAP Fresher Resume/ CV Writing Format..