18 November 2008 - 2.5 |
soapUI Pro introduces the unique concept of WSDL Coverage, which dynamically allows you to analyze how much of a given Interface or WSDL is being covered by your Functional Tests, MockServices, Mock Clients and SOAP Monitor clients and targets. This document aims at giving a brief overview of the concepts of WSDL Coverage, with links to the corresponding documentation for each Coverage point in soapUI. The best way to learn is to play around with it!
Traditionally in environments such as Java or .Net , coverage is used to measure how much of the actual code base that is being used during a given execution scenario (usually during Unit Tests). The returned value tries to give an estimate of how much of the code base that is actuality being used or tested.
Web Services in soapUI are defined by a WSDL contract, which specifies the operations, message, faults, etc... that make up the web services functionality. For each message there is generally a finite amount of defined elements attributes that can be used to convey the message content, divided among message bodies, headers and faults.
The WSDL Coverage functionality analyzes each messages contract definition and then compares all corresponding messages during for example a TestRun to calculate how many of the defined elements or attributes that were actually used during the tests. The result is in soapUI presented as both a percentage and a visualization of the actual message; "Message Coverage"
Further, when running functional tests, soapUI analyzes the performed XPath assertions, and will try to calculate a corresponding value of how many of the defined elements or attributes that have actually been asserted. This result is added to the Message Coverage presentation and called "Assertion Coverage".
In all situations where Coverage can be calculated in soapUI, a Coverage Panel is available with the following basic layout:
The Coverage Tree displayed to the left is divided into 2 parts:
Double click an item in the tree will try to open that items corresponding editor/viewer
As mentioned above, when running functional Tests, all performed XPath assertions are analyzed and a coverage value measuring how large part of the WSDL contract that was actually asserted. Assertion Coverage is displayed in dark-green in both the Coverage Tree and the Message Inspector. In the image below, the Message Coverage Inspector shows that the item and contained values have been asserted by an XPath expression, the assertion can also been seen in the Assertion Results Inspector at the bottom.
The Coverage Options dialog available from the toolbar allows you to set the following options:
"{" + Namespace URI + "}" + local part
which
should be excluded from coverage calculations."{" + Namespace URI + "}" + local part=comma-seperated list of values
which will count coverage for the specified values. For example if you have a weekday element you could enter
{http://my.namespace}weekday=mon,tue,wed,thu,fri,sat,sun
and coverage will be calculated for the complete set of values.soapUI allows you to measure coverage in 3 distinct scenarios: