To quickly add diff comparisons to your SOAP Client and REST Client tools, you can create Diff tools directly from the CTP interface. The Diff tool compares the data in its editor against a specified regression control and reports a failure when it finds a difference. The Diff tool can be used for JSON, XML, text, or binary.
Any Diff tools added from CTP will be attached to the response of the selected test.
Additionally, you can edit Diff tools that were added to the response traffic using SOAtest desktop. Any Diff tools that are added to the request traffic using SOAtest desktop will not be visible in CTP. Binary diff tools can be edited, but not added, in CTP.
If you want to check whether all or most parts of a message match a regression control, use a Diff tool. If you want to check a specific element of a message—and/or if you want to validate something other than a match—use an Assertor. |
To add a new Diff tool:
The new tool will be "chained" as an output to the response of the selected test client tool. Header Diff tools are chained to the response header. All other Diff tools are chained to the response body message.
To configure a Diff tool:
In the Regression control area, specify the "control" value (the value against which it will compare all subsequent results). Depending on the Diff type selected, you may have access to a literal text editor, a JSON editor, and/or an XML editor (see Editing JSON Messages and Editing XML Messages for details and tips).
If CTP has access to new traffic that is different than the current regression control, you can click the Update Regression Control button to copy the new traffic into your regression control. |
Option | Description |
---|---|
Diff engine | Specifies what diff engine is used. XMLUnit is the default; it provides support for large messages, comparisons that generate a large number of differences, and the ability to ignore changes in element order. Diff tools created in older versions of SOAtest tools may be configured to use VMTools or ExamXML MDCXML. |
Ignore element order | Configures the tool to ignore element order throughout all areas of every processed document. Note that if you’d rather ignore order for only a specific part of the document, use the SOAtest XML Sort tool to sort that part before passing the document to the Diff tool. |
SOAP mode | If this is selected, the following actions are enabled:
|
Regular expression | Determines whether the expected value will be parsed as a regular expression. If this box is unselected, the control value will not be parsed as a regular expression. If this box is selected, the control value will be parsed as a regular expression. For example, the following regular expression may be entered: Java[a-zA-Z ]+\Q(\E[4-9]+th Edition\Q)\E Where the actual string extracted may be the following: Java How to Program (4th Edition) The regular expression will parse through the above string to check if "Java" appears as the first substring, followed by one or more occurrences (indicated by the + operator after the open and closed brackets) whereas the occurrences are limited to only letters ranging between a-z and A-Z and whitespace. Notice we escaped ( and ) by adding \Q and \E around ( and ). This needs to be done because open and closed parentheses can be part of a regular expression, therefore they need to be escaped if they are represented to be substrings. We also have a digit appear after the first open parenthesis which is indicated by [4-9]+. This specifies at least one occurrence of a digit between 4 and 9 that should appear and be followed by "th Edition". Lastly, we have the closed parenthesis which we escape with \Q\E. |
Ignore whitespace | Determines whether empty lines and whitespaces at the end and beginning of input lines and diff control lines are ignored. If this box is unselected, empty lines and leading/trailing whitespaces will cause the regression test to fail. If this box is selected, empty lines and leading/trailing whitespaces will be ignored. A whitespace is any of the following: horizontal tabulation, new line, form feed, carriage return, space. An empty line is a line that contains one or more of these whitespaces. |