1.

What do you understand about XPath Assertion in SoapUI? Also, state your understanding of Data Driven Testing.

Answer»

The XPath assertion is used in SoapUI to assert the value of a web service response by specifying the absolute path. The test case or test suite will be marked as PASS if the absolute path matches the response value; otherwise, it will be marked as FAILED. The assertion results can be seen at the BOTTOM of the screen in the Assertion tab. XPath assertion selects the target node and its values using an XPath expression. It compares an XPath expression's result to an expected value. XPath is an XML query language that allows you to pick nodes from an XML document. Given below are the steps which can be taken in order to add an XPath Assertion  in SoapUI:

  • SELECT Assertion Category – Property Content after clicking Add Assertion.
  • Then click Add and pick Assertion Type – XPath Match. The wizard for XPath Match Configuration appears. The NameSpace must be DECLARED before an XPath may be added. An XML namespace is a set of names that are used as element and attribute names in XML documents and are identifiable by a URI reference. SoapUI XPath Assertion does the same thing.
  • Click the 'Declare' button to automatically declare an XML Namespace; otherwise, manually declare a namespace.
  • Refer to the XPath using the newly established namespace after declaring the namespace. When you click the 'Declare' button, two NAMESPACES with two URIs will appear. The schema URL is one of them, while the REAL web service URL is the other. When accessing XPath, we must use the real namespace where the web service is situated, not the schema namespace.
  • Input the XPath of the XML node which needs to be checked. //ns1:ConversionRateResult gives the value of the node enclosed between <ConversionRateResult> and </ConversionRateResult> and ns1 stand for the declared namespace pointing to 'www.webserviceX.NET'.
  • After inputting the XPath, click the 'Select from current' button to take up the value from the current answer for future comparison. The user has the ability to change the value.
  • Save the file. 

As demonstrated in the accompanying screenshot, the added assertion will be presented.

Data Driven testing entails storing our test data, which includes both input and expected output, in an external data source such as Excel, Database, or XML file. The data source must then be iterated using the appropriate component. For data-driven testing in SoapUI, the Datasource and Datasource Loop test steps are employed.



Discussion

No Comment Found