When creating regression controls, it may be helpful to ignore dynamic values such as timestamps or session variables that can cause your regression test to fail. In the bookstore example, the “price” element is a dynamic value, with the price of the book increasing by $1 every five times the test is run. In this example we will set up an XPath Property to globally ignore the “price” element value in all tests.
- Run Test 1: getItemByTitle a few times. Notice that after a few test runs, the regression test fails and a task is reported in the Quality Tasks view. This is because the
price
element has changed. In this case we want to ignore the value of theprice
element. - Right-click the error message in the Quality Tasks view and select Ignore XPath from the shortcut menu.
An Ignored XPaths Settings dialog opens. The XPath of theprice
element,/Envelope/Body/getItemByTitleResponse/book/price
, is automatically populated in the XPath field. - Make sure the Recursive, Text Content, and Modify options are enabled and click OK. This will instruct the regression test to recursively ignore any modifications to the text content of the price element.
- In Test 1: getItemByTitle, double-click the Response SOAP Envelope > Diff control node.
- Open the Ignored Differences tab in the test configuration panel. The Ignored Differences dialog displays. Notice that the XPath of the price element has been added to the Ignored Differences List.
All of the price
element values with the specified XPath are now being ignored. Run the functional test again and it will succeed.