2008 Dec 02 11:32 AM
Hi there,
we have some really horrible SAPScript and SmartForms here, mixing up presentation with business logic and database table selects in the layout (!).
We want to refactor these objects. We have some test data at hand to continouously reproduce the form. And we have some expectations on the output document. The result could be saved as a PDF document and then scanned by an appropriate tool?
Other approaches?
Any experiences out there?
How to write Unit Tests? Is this possible at all? Or is integration test the only option?
Regards,
Rüdiger
Hi there,
we have some really horrible SAPScript and SmartForms here, mixing up presentation with business logic and database table selects in the layout (!).
We want to refactor these objects. We have some test data at hand to continouously reproduce the form. And we have some expectations on the output document. The result could be saved as a PDF document and then scanned by an appropriate tool?
Other approaches?
Any experiences out there?
How to write Unit Tests? Is this possible at all? Or is integration test the only option?
Regards,
Rüdiger
2008 Dec 02 1:10 PM
Hi Rüdiger,
I was just a bit confused over your query.. I was not able to understand what is the actual problem you are facing. Too many Q's u asked 😛 ..
Could you elaborate the main Q a bit so that SDN can help you.
Njoy-
HS.
2008 Dec 02 1:12 PM
Hi Harmeet Singh,
the main question is:
How can the generation of forms (may it be smartforms or sapscript) be tested automatically.
Thanks and regards,
Rüdiger
2008 Dec 02 1:36 PM
You may create a driver program to accept Smartform Name as input parameter..
Pass this Smartform name to FM SSF_FUNCTION_MODULE_NAME, get FM name for Smartform
and call it in the program.
You will need some type of grouping of type of Smartforms developed to call FM for Smartforms.
Moreover, If you have any common parameters to be interfaced to Smartform, you can put those as well on selection screen.
Regards,
Mohaiyuddin
2008 Dec 02 2:18 PM
Hi Mohaiyuddin,
finding and calling the smartform module is the simple part. The complicated part is to let the machine check automatically the created form against business expectations:
The function module creates a document in the spooler. The business guy knows: There must be a table in the form containing precisely two line items, and the second line must be for material number 4033871 with price 40.71 CHF.
How let the machine check such expectations automatically? If I want to refactor a large SmartForm, I don't have the time to check these expectations manually after each redesign step.
Thanks and regards,
Rüdiger
2008 Dec 02 3:01 PM
Smartform and SAPScript Spool would be an image or one entire object for the automatic testing tool.
One thought on reading the data from the output is:
Print Preview the Smartforms or SAPScript output
Select Goto > List display
Press the Binocular (Find)
Enter your Term (e.g. Material number "4033871")
Select the appropriate line from the hit list of the result
If you are using some kind of automated tool, there might be a possible way to record these steps and "Retrieve" the values from the actual line.
Regards,
Naimesh Patel
2008 Dec 03 6:25 AM
Hello Naimash,
thank you for the answer. I didn't know this menu path. There is a function module SSFDISPLAY_OTF_LIST underlying this menu path. I will check out wether this module can be called in the background. It can be combined with the usual conversion of ABAP lists to plain text (as used in "System->List->Save to file"). Finally, regular expressions or a common diff tool can be used to check the expectations. All this could equally well be performed in an ABAP program.
Since all the texts of the smartform appears in the result document, this permits to check at least all the form content. Layout and images get lost. But this could be verified after the redesign in the integration test phase. For the refactoring process, verification of the text content for various processes will be sufficient.
Thanks and regards,
Rüdiger