In this blog I'd like to show you how easy it is to use Oracle Litmus, a new feature added to Integration Cloud for creating unit tests automatically with a few clicks and run those tests to catch regressions. Litmus supports the following use cases:
- Enable Integration Cloud users to create unit tests automatically and play them back to catch regressions when they modify their integrations (typically when they enhance an already created integration before making it production).
- Enable Integration Cloud QA to catch product regressions as part of a new release of Integration Cloud.
- Send Oracle a recorded instance so that Oracle can play back the instance to reproduce an issue or a bug. This is difficult without Litmus because all the dependent endpoints and third party adapters might not be available in-house to reproduce the issue. With Litmus, the endpoints are simulated and hence not needed to reproduce the issue.
Let's assume that you have built an integration which runs as per your requirements and you have completed all your manual testing. Now you are ready to go production. At this point, you might want to create a Litmus Test and want to check that into your source repository. This is so that when you want to change that integration later, you can rely on the Litmus test to catch regressions. Regression in this case is an assertion failing because the response you're sending to the client has changed due to a bug that was introduced in a mapping as an example.
Enable the Litmus with below steps:
- Login as a developer.
- From the list of integrations displayed in the integrations page, click the inline menu for the integration and click Oracle Litmus -> Enable Litmus Recording
- You can also enable Litmus as part of the Activation as well .
Creating a test using Litmus
After the Litmus is enabled, you can create a test for a given integration using the below steps:
- Run your integration once. That's it. Your Litmus Test (also called as Recording) is created now.
- To check the recording, go to Oracle Litmus -> Recordings and you can see the recording is displayed. The last one created will be displayed first.
- You can create up to 5 recordings for a specific integration.
- Note that a given integration can take multiple path or branches depending on certain values in your input payload. So you might want to create multiple recordings by sending different input values. You can identify each recording using the Primary Identifier column.
Exporting and Importing a test
After a recording is created, you can export and import a test for a given integration using the below steps:
- Login as a developer.
- From the list of integrations displayed in the integrations page, click the inline menu for the integration and click Export
- Check the box that says Include Litmus Recordings.
- To import a recording click the button at the top right that says Import.
- Select the integration archive file (.iar) and check the box that says Include Litmus Recordings.
Playing back a recording
After a recording is created, you can playback a recording for a given integration using the below steps:
- Go to Oracle Litmus -> Recordings and identify the recording from the list that you want to playback.
- Click the playback button.
- At this point, the recording is played back asynchronously and follow the next section to check the status of the test run.
Checking the test status
After a given Litmus recording is played back, you can check the test status using the below steps:
- Go to Monitoring -> Tracking.
- Identify the Litmus instance from the list of runs. To differentiate the Litmus run, you can see Litmus Instance tagged at the top as displayed in the image.
- You will also see the Test status displayed at the top as well.
- In order to see the details of the assertion, you can click Oracle Litmus Result from the top right inline menu. This will display the golden input that was stored earlier as part of the recording which was compared against the actual response. If there is a match, the test will pass else the test will fail. Note that this will be a XML comparison and not a string comparison so that the prefix differences are ignored.