Posts

SAP CPI Testing, now with Mock and secured data

Testing is not really fun. But you need to perform it.

Making a good unit test for SAP CPI and testing full iflows is one of the more complicated processes. You could create some test cases but it became pretty difficult to manage

1) Testing with mock services. This is if you have SuccessFactors systems you cannot call once you want to run regression tests. Then the Figaf tool will replace calls to SuccessFactors and replace them with an HTTP call to Figaf. In the request, it will inject the expected response. So you can get to test scripts, routing, and flows.

2) Secured testing. The best test data you have is from production. This is in many cases confidential like HR data. You, therefore, do not want all your developers to see the information. That is why we have added secured testing. This ensured the payloads are masked in the Figaf tool, so normal developers only see masked data. So they will be able to determine something is wrong but to get the name of the person.

We have written a lot more about the secured testing that also is for SAP PI/PO.

You can see how this works in the following video.

3) Groovy unit tests based on the Figaf test cases you have. This is a simple way to test all your groovy scripts in an Iflow. We have bundled this with the Git integration to make it possible to run the development process simpler. This allow you to run and debug your groovy scripts and it is a lot faster to develop in that way.

Try it out

There is free trials of the tools at https://figaf.com/irt. You can get started in less than 60 minutes to try out what the tool is able to.

If you any questions email info@figaf.com and we will answer your concerns.

Figaf runs Figaf (SAP CPI Git Groovy scripting)

This week I wanted to try to use our Git for SAP CPI tooling to make some new development and see how it would work out. I wanted to create an SAP CPI microservice to convert XML to PDF, you can see all about it here.

The idea with our Git integration is to take all content from your SAP CPI and API repositories. So it will synchronize all the content in the CPI repository to the Git. The user will then be able to see each iflow with the individual resources. In the Git repository, we had templates to some Gradle plugins. They allow you to upload the content directly to your SAP CPI agent and deploy it all from your IDE like IntelliJ or Eclipse. This speeds up the development because you don’t need to edit files in the WebIDE or upload them manually.

A real editor gives you the option to get syntax highlighting, autocompletion and debugging options. To achieve the running and debugging option we are able to leverage a real test performed with SAP CPI.

Our ide was to make it as simple for normal integration users to be able to edit and run their Groovy scripts without having to know a lot. In my free course about Create SAP CPI Integration faster, I’m covering how you can use the Figaf IRT tool to create a Git repository and configure all parameters, so you can use this development approach. It probably takes you 15 minutes to the repository working. So it is pretty simple.

You can see what the project was about and how the tool worked in this video.

Lessons learned

This was the first time I really used this function to create a useful Groovy script.

  1. It was possible to run the Groovy script pretty simple with the test data generator. That way I could run the message and get the correct output back. Once I was developing the groovy script I could then run it locally in my IntelliJ and even run debug.
  2. Out standard git template does not allow .jar files in the .gitignore file. It is best practice not to have jar files in your git repository because they take up a lot of space. In most cases, you will find the files in a maven repository and use them at runtime. A workaround we used was to add the path to the jar files with the following line in the .gitignore file !demo/XMLtoPDF/src/main/resources/lib/*.jar . ({package}/{iflowname} /src/main/resources/lib/*.jar .You can then add lines for all the iflows you are working on with the tool.
  3. The more you understand Git and Gradle the better. It will make it easier for you to use this workflow.
  4. Our comparison did not understand that the payload was binary for comparison. So it probably does not make a lot of sense to have test cases for it. In the PDF you have a time that is increasing and most of the content is binary. It was possible to create manual test cases and use it to check if the payload was successful.

Conclusion

It does take some time to get use to develop with the Figaf tool to create your SAP CPI iflows. Once you do understand how to create a test case and run it. It is much easier to work in the confines of IntelliJ when you are experimenting and do not know what you need to fix for the code to work.

Try it out your self.

I hope you want to try it out your self. It takes 15 minutes to get started and then you can have all your SAP CPI content in a git repository.

Just go to download it at Figaf IRT