接口测试工具 SOAPUI
关于使用SOAPUI进行接口自动化测试的工具书。目录1. SOAPUI的介绍11111152. SOAPU的安装…2,1, SOAPUI下载22, SOAPUI安装3.名词解释111131.基础知识3,2,附加名词解释灬…1104.应用场景····鲁····41,导入项且看·········自鲁·●···看···············看············自即·鲁命看看·春·····即●············142. WEB SERVICE MOCKING.4.3. WEB SERVICE INSPECTION44,对 WEB SERVICE服务进行功能测试45,对 WEB SERVIC服务进行负载测试●ee香。。。。鲁 DUDDDDOU。ee。自a看。。。春。。bBe。e。自看看鲁。非205.基础讲解5,1.创建工程………………235,2,测试结构的组织和执行3053,测试步骤345.4创建功能测试用例…3655.功能测试断言判断385.6,功能测试用例热行b自自看香香e.。。鲁4057创建负载测试用例58执行负载测试用例····.·59.负载测试断言判断看t43510,创建 MOCKSERVICE445,11.编辑MOCKSERVICEoaamnasa.an455.12.调用 MOCKSERVICE…465,13.自定义模拟响应····································476,操作技巧5061.右键点击6,2,测试的管理…5063.命名建议…n5064,共享操作管理-SⅤN…,,.,65.属性操作曲看西由自曲曲a函看自曲536.6,接囗变化5667数据库操作…6068.数据文件操作6369循环入参●命●·看··············鲁··●·●·····························666,10,流程控制,,69611.脚本处理…·································息身········看·····612,数据初始化-清理74613,断言操作·看············●·····看●·············命●····看·········即··76614.定时保存615,响应报文85616.日志查询86617,导入和检查项目86618,发布测试报告…1876.19.加密项目∴904.完整的应用一待补充5,测试工具的简单对比…1. SoapUI的介绍由于web服务是被程序调用的,一般不会提供界面让最终用户或测试人员直接使用,在 Soap等工具出现之前,测试人员不得不自己编写程序来测试它,这就要求测试人员花费很大的精力了解底层的接口,调用关系和详细的协议,导致他们不能把注意力集中到测试中Soap的出现极大的改变了这一局面。作为一个开源的工具, SoapUI强大的功能、易用的界面,吸引了很多用户。用户可以在 SoapUI中通过简单的操作完成复杂的测试,不需要了解底层的细节,极大的减轻了工作量。 Soap支持多样的测试,例如功能测试,负载测试,回归测试等。到目前为止 SoapUI的下载量已经超过了100万次,成为了Web服务测试标准和领先的Web服务测试工具。它不仅仅可以测试基于SOAP的Web服务,也可以测试REST风格的Web服务,前者是本文介绍的重点。2. SoapUI的安装21. Soap|下载SOAPUI的网站地址是:http:/www.eviware.com,网站提供了多种soapy安装包的下载, Soapui主要提示三种不同的版本,分别是:(1) SoapUi pro是收费版本,拥有强大的功能,本文主要围绕着这个版本的功能进行阐述,该版本的下载地址是http://www.eviware.com/download-sOapul/download-soapui-pro.htmlLatest ReleasesoapUI PRO 3.6.1windows 32-bit installerD DownloadA Linux installer》 Downloads Mac installer》 DownloadWindows binary zipD Downloadwindows 64-bit installer(no JRE)》 Downloada windows binary zip (no JRE)》 DownloadA Linux binary zip(no JRE》 DownloadMac binary zip (no JRE》 Download(2) SoapUl Trial是试用版本,拥有的功能和 Soapui pro-样,但这个版本在申请成功后仅有14天的试用期,建议在开始读本书的时候,可以申请一个试用版进行学习,该版本的下载地址是http://www.eviware.com/download-sOapul-trial.htmlDownload soapUI TrialIn order to obtain an Tral License for soapUI Pro you need to fill out the form below. The intormation proviced willcnly be available to eviware employeesIMPORTANT: We will send a license to the e-mail address supplied; please make sure that it is correct. If you havenot received a license in 24 hours, please contact eviwarevebmasteroeviware. coma 14 day ssapUI ProE-mall addresssAfter registraton you will be redirected to a download page and the license will be emailed to the specified addressDownloading a triel signifies your agreement to evinare contacting you oucasionally with promotional material.(3) SoapUI是开源的版本,这个版本我也曾经使用过,这个版本提供的功能较少,但由于它开源,只要你有兴趣,可以到网站上下载源代码,根据需要对源代码进行修改,改造成你希望的方式。对于这个版本,如果你熟悉 groovy的编写,那么在测试过程可以使用 groovy脚本来丰富你的用例,该版本的下载地址是:http://sourceforge.net/projects/soapui/filesource orge net Find sortware> soapuI> Browse FiesG soapUI by ebonsu, nreimertz, omatzuraSummary Files)SupportDevelopsoapUl is the leading desktop application for inspecting, invoking, monit oring, simulating/mocking andfunctional/load/compliance/surveillance testing of REST/WADL and soAP/SDL-based web Services overHttpDownload now!Viow all files 3soapul-x32-3 61 exe (110.2 MBBr。 wse Files for soapUlFile/Folder NamePlatform SizeDateDownloads Notes/SubscribNewest Flesa com-eviware-soapui-netheans37.32010-10-2134module nbmA soapul-ldea-plugln-3.6. 1 zip9142010-10-2118soapul-idea-plugin-3.6.1-src,zip191.12010.10-214n soapui-eclipse-plugin-3.6.1 zip201010215322. Soap安装SoapuI基于Java开发,支持多个平台,需要设置 JAVA HOME变量指向到相应的JRE目录,同时修改PATH变量,将JRE1.6的bin目录添加进去。安装的过程很简单,只要双击已成功下载的exe程序,即可开始安装过程) install4jWizardxsoapUI 3. 5. 1 is preparing the install] wizard which willguide you through the rest of the setup processCancel在安装向导完成后,很快可以看到下面的开始对话框:O Setup-soapUI3.5.1Welcome to the soapUI 3.5.1 SetupWizardThis will install soapUI 3. 5. 1 on your computer.It is recommended that you dose all otherapplications before continuingClick Next to continue or Cancel to exit SetupNextCancel点击Nxt进入下一步,你需要阅读 soapui要求的协议,并接受协议才能进入下一步:O Setup-soapUI3.5.1License AgreementPlease read the following important information before continuingPlease read the following License Agreement. You must accept the terms of thisagreement before continuing with the installationsoapui,copyright(c)2004-2010eviware.comsoapUI is free software; you can redistribute it and or modify it underthe terms of version 2. 1 of the GNU Lesser General Public License aspublished by the Free Software Foundation.soapUI is distributed in the hope that it will be useful, but WITHOUTANY WARRANTY;without even the implied warranty ofMERCHANTABILITY orEITNESS FOR A PARTICULAR PURPOSE, See the gNU lesser generalo I accept the agreemeOId not accept the agreementBackNextCancel选择接受,并点击Nex进入下一步,这里要求设置程序安装的路径, soapui会给出默认路径,如果你不选择,则会默认安装在C: Program Fileseviware' soapUI-3.51:5 Setup-soapUl3.5.1Select Destination DirectoryWhere should soapUI 3.5. 1 be installed?Select the folder whUI 3. 5. 1 to be installed, then dickDestination directoryBrowseRequired disk space: 157, 5MBFree disk space: 23, 862 MBstall jBack接下来,可以根据需要选择要安装的组件:O Setup-soapUl3.5.1Select ComponentsWhich components should be installed?Select the components you want to install; dear the components you do notwant to install. Click Next when you are ready to continue团 SoapO i Source B回 Hermes回Installs HermesJMS which is the application thatallows soapUI to interact with JMS provideRequired for JMS Testing)installBackNextLance如果是 soapUI pro版本,JDBC的驱动包会提供选择,但是没有源代码可勾选0 Setup- soapUI Pro 3.5.1回Select ComponentsWhich components should be installed?Select the components you want to install; dear the components you do not want toinstall, Click Next when you are ready to continue团 SoapUI Pro回白□ Install JDBC drivers回 Postgres JDBC3 Driver-version8364国回 Postgres JDBC4 Driver-version8.3604国回 MS_SQL DriverHermes]國Installs HermesJMS which is the application that allowssoapUi to interact with JMS providers (required for JMSTestin< BackNextCancel如果勾选了 HermesjMs,那么下一步还需要接受 HermesjMs的协议,接下来只需要默认安装即可,直到出现下面的页面,点击 Finish完成全部安装过程,接下来你可以开始学习和使用的过程了。0 Setup-soapUI3.5.1Completing the soapUl 3.5.1 SetupWizardetup has finished installing soapuI 3. 5. 1 on yourcomputer. The application may be launched by selectingthe installed iconsClick Finish to exit SetupF Yes, I would like to view the README fileV Run soapUI 3.5.1Finish3.名词解释3.1.基础知识在 Soap的各种版本里,我们都能深刻地体会到它所提供的测试用例的管理与我们测试项目所需要的层级的映射关系是相当贴近的,对应关系图如下:Soapui中的体现实际项目的情况工作空间 Workspace测试项目项目 Projcct大功能模块测试集 TestSuite小功能点测试用例 Testcase功能测试用例测试步骤 TestStep功能测试步骤SoapUI里着重引入了以下的概念√测试步骤 Tes p测试步骤是最小的单位,一个完整的测试用例是由多个测试步骤所组成的,而每一个测试步骤,都需要根据实际的业务要求进行组织测试用例 Testcase个测试用例代表一个完整操作,接口测试的目的,实质在于模拟外部的调用来验证接囗的功能,而接口功能的各个分支则由入参(测试数据)的不同来遍及。测试集 Tes tsuite对于测试集,主要是为了区分大功能模块里的不同小功能点而引入的概念,一般一个Web service都包含有多个接口,此处可根据需要添加测试集。√项目 Project在 SoapUI里,一个接口对应一个项目( Project),这是由 SoapUI提供的功能所决定的,在每次要测试一个新的接口时,可以右键点击 Workspace的名称,从右键菜单中选择New soapUI Project来引入新的WSDL工作空间 Workspa对应测试项目的概念,一个测试项目中可能会包含多个 Webservice接口,这些接口都同属于一个项目中,由工作空间来管理所有的接口项目。32.附加名词解释WSDL:指网络服务描述语言( Web Services Description Language),是一种使用ⅹML编写的文档。这种文档可描述某个 Web service。它可以规定服务的位置,以及此服务提供的操作(或方法),更加详细的内容可以参考:http:/www.w3school.comcn/wsdl/wsdldocumentsasp√Reqμuest: Soap通过导入正确的WSDL,便可以解析接口需要的入参。当对特定的接口创建一个请求时, SoapUI会帮我们把需要的SOAP报文的结构以一定的形式显示出来,此时你只需要输入请求的内容,点击运行, SoapUi会将我们填写后的SOAP报文完整地发送给远程服务接口进行调用。a区口0·0:sy1+旨√发运请求的按钙view Type: All一目3三三王 xs:Transfer toa回1 oginRequestusername * Logind password *: Loginn12e Xsd: string)返回的结果报文会显示在这个区域请求报文Y MokeService: SoapUI同样也提供了Moke服务的功能,在初期确定完接口出入参、接口名时,我们便可通过 ShapUr的Moke服务功能,人为地模拟系分文档中明确要求的各种情况下的返回参数(根据返回参数的类型编写对应的SOAP报文),使测试人员在早期就进行接囗测试用例的编写和调试。
用户评论