SDN Day Amsterdam session proposal: Unit testing XI mappings with Detroubulator
In this blog entry I’d like to give a brief, FAQ-style description of the session I’ve proposed for the SDN Day in Amsterdam. The topic of the session is Detroubulator, an open source unit test tool for XI mapping programs, that I’ve written together with my esteemed colleague http://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/u/23912 [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken].
So what is Detroubulator, anyway?
Detroubulator is a software tool for automated unit testing of SAP XI mapping programs. It started life because we needed a tool for our day-to-day work, that would take some of the pain out of manually testing mapping programs in the Integration Builder. That tool did not exist, however, so we ended up writing it ourselves. We are releasing Detroubulator as open source, specifically under the GNU General Public License.
Why do I need it?
The number one reason is that automated unit testing greatly reduces the effort required to repeatedly test your mapping programs. While it’s definitely possible to manually unit test mapping programs in the Integration Builder, it’s a time-consuming and error-prone task that must be done every time a change is made to the mapping program. By using an automated unit test tool like Detroubulator, you write your unit tests once and for all and run them at the press of a button.
The minimal effort required to run your unit tests means that testing can become an integrated part of development rather than an effort that only takes place when development is complete. Having a suite of unit tests available also makes it easier and safer to make changes to an existing mapping program; running your test suite at each step of the way builds confidence that the changes made to the mapping program didn’t introduce errors.
How does it work?
Every test case that you want to execute is stored in a test file, which is a simple XML document, that also holds information about the mapping program under test. Each test case refers to an input document and contains a number of assertions about the result of executing the mapping program with the given document as its input. You can optionally provide transformation parameters such as message ID, sender interface etc.
When the Detroubulator tool is executed from the command line of your local machine, it reads the test file, passes each input document to the remote XI server and evaluates each assertion against the mapping program’s output. If a test fails, its details will be reported. How they’re reported is configurable. One option is to generate an HTML report containing the test results. Another option is to have the results output directly to the command line. In both cases, Detroubulator stores the mapping program output of failed tests to disk for debugging purposes.
What are the system requirements?
Detroubulator requires a Java 5 runtime and the SAP JCo libraries installed on your system.
When can I get my hands on a copy?
The first public release will be made available online on October 17th, coinciding with the SDN Day in Amsterdam. More details will follow here on SDN when the release date nears.
What’s your session’s agenda?
Besides demoing the tool, I’ll be covering the following topics:
- The benefits of automated unit testing
- How to get up and running with Detroubulator
- Unit testing best practices