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.

  1. 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 the price element.
  2. 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 the price element, /Envelope/Body/getItemByTitleResponse/book/price, is automatically populated in the XPath field.
  3. 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.
  4. In Test 1: getItemByTitle, double-click the Response SOAP Envelope > Diff control node.
  5. 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.

  • No labels