Introduction to the WEB Service Unit Test tool example Soapui

Source: Internet
Author: User
Tags soap soapui

Introduction to the original WEB Service Unit Test tool example Soapui

Soapui is a simple and practical open source Web Service Testing tool that provides both desktop applications and IDE plug-in programs. The ability to quickly build projects and organize test cases is a major feature of the tool, and the following examples show if you use SOAPUI for Web service unit testing.

L Build Projects

The project in the Soapui tool is made up of one or more Web services, where we use the Chinese TV trailer Web service:

HTTP://WWW.WEBXML.COM.CN/WEBSERVICES/CHINATVPROGRAMWEBSERVICE.ASMX?WSDL "For example, create a new WSDL project. Click FileèNew wsdl project, Enter the project name "CHINATV", initial WSDL "

Http://www.webxml.com.cn/webservices/ChinaTVprogramWebService.asmx?wsdl ", 1:690) this.width=690;" src= "http:// Www.52testing.com/FUploadFile/0008.JPG ">

Where WSDL can be either a URL or a static file of WSDL.

L operation of a single service request

The SOAPUI tool parses the WSDL file to get the service interface and creates the request. 2, 3: The service provides 8 interfaces, and provides two different versions depending on the version of SOAP.

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/0009.JPG "> 690" this.width=690; "src=" http:// Www.52testing.com/FUploadFile/00010.JPG ">

Expand the SOAP request "request1" of the Interface "gettvstationdataset":

Double-click to view the requested SOAP message: 4

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00011.JPG ">

What we see is the service Request SOAP message, where the "?" The question mark represents the entry parameter, which is modified to request the parameter value "1" (in this instance, 1 for the Central TV), and then click the icon button to run and get the request result: 5

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00012.JPG ">

We see the SOAP message returned and the data in it.

L Build Test Cases

Select Project "CHINATV" and right-click, choose New TestSuite, build a test suite 6

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00013.JPG ">

Then, right-click in Testsuite, select New TestCase, create a new TestCase and add the service request to TestCase: 7

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00014.JPG ">

In this way, we have the first test case: 8

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00015.JPG ">

Because the service request entry is already set up in the procedure above, we double click TestCase 1 Click to run directly: 9

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00016.JPG ">

We see the "Green bar", which means running through.

L Increase the checkpoint.

, open service Request gettvstationdataset–request 1, click, add Checkpoint: 10

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00017.JPG ">

There are several types of checkpoints, here we choose to include "Contains" and enter the check content "CCTV": 11690) this.width=690; "Src=" http://www.52testing.com/ Fuploadfile/00018.jpg ">

We run a service request Gettvstationdataset–request 1: 12

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00019.JPG ">

You can see that the checkpoint is valid:contains-valid.

L organize test steps

Getareadataset (a list of supported provinces, cities and categories), Gettvstationdataset (a list of stations with a provincial or classified TV ID), Gettvchanneldataset (get the TV channel list via TV id), Gettvprogramdataset (get the channel's program list by Channel ID), add to the test step in TestCase 1, then organize the test steps to get " CCTV-1 "List of programs.

Test steps:

1. Get "Central TV" category ID "1"

2. Get "CCTV" ID in "Central TV" Category: "39"

3, access to "CCTV" channel "CCTV-1" ID: "606"

4. Get the program list of "CCTV-1" channel 13

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00020.JPG ">

We need to Getareadataset the "Central TV" ID "1" in the result of the service request as a service request Gettvstationdataset , right-click Getareadataset-request 1, select Insert StepèpropertyTransfer, 14:

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00021.JPG ">

This property transfer is used for the interaction between the two service requests, and we name it: "Areatransferstation" 15

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00022.JPG ">

In Source we choose getareadataset-request 1 response,target We choose the Request of gettvstationdataset-request 1 , The service request is passed to the service request Getareadataset The value of the node (Arealist[4]) in the returned result SOAP message (areaid[1]) through a script selection Gettvstationdataset As the value of the entry parameter (Theareaid[1]).

Including: Declare namespace diffgr=

"Urn:schemas-microsoft-com:xml-diffgram-v1", which declares a namespace, corresponds to a namespace in a SOAP message. 16

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00023.JPG ">

The same procedure, we organized a number of other service requests between the interaction, the organization completed a complete test steps, finally we run testcase, see all the results: (green means running through) 17

690) this.width=690; "src=" Http://www.52testing.com/FUploadFile/00024.JPG ">

Note: SOAPUI official website http://www.soapui.org/

Examples of WEB service Unit test tools SOAPUI

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.