Soapui complete basic test (from csdn) do not ask why Series 5

Source: Internet
Author: User
Tags soapui
Use soapui to test the performance pressure of WebService. Add to favorites 1. Create a test project
Select to test multiple methods in a test case and generate a stress test for the test: 2. Add a variable for the test step:
Right-click test step and add a grooy script step. Add a variable count and set the initial value to 0. 3. Add a random variable:
Right-click test step and add a grooy script step named Rand. Code Generate a random value view plaincopy to clipboardprint?
01. Random Rand = new random ()
02. Result = "test _" + Rand. nextint (100)
Random Rand = new random ()
Result = "test _" + Rand. nextint (100) 4. Use dynamic parameters:
Open the SOAP request of the init operation and randomly Replace the input parameter with the view plaincopy to clipboardprint?
01. <soapenv: envelope xmlns: soapenv = "http://schemas.xmlsoap.org/soap/envelope/" xmlns: Web = "http://webservice.test.jastar.com.cn">
02. <soapenv: Header/>
03. <soapenv: Body>
04. <Web: Run>
05. <Web: in0 >$ {Rand # result} </Web: in0>
06. </Web: Run>
07. </soapenv: Body>
08. </soapenv: envelope>
<Soapenv: envelope xmlns: soapenv = "http://schemas.xmlsoap.org/soap/envelope/" xmlns: Web = "http://webservice.test.jastar.com.cn">
<Soapenv: Header/>
<Soapenv: Body>
<Web: Run>
<Web: in0 >$ {Rand # result} </Web: in0>
</Web: Run>
</Soapenv: Body>
</Soapenv: envelope> 5. Select the operation as required:
Similarly, add a grooy script step named exechandler, which is used to execute view plaincopy to clipboardprint in the condition control case?
01. Def countprops = testrunner. testcase. getteststepbyname ("count ")
02. Def Index = countprops. getpropertyvalue ("count ")
03. If (Index = "0 "){
04. testrunner. runteststepbyname ("init ")
05.} else {
06. testrunner. runteststepbyname ("Run ")
07 .}
08. countprops. setpropertyvalue ("count", "1 ")
Def countprops = testrunner. testcase. getteststepbyname ("count ")
Def Index = countprops. getpropertyvalue ("count ")
If (Index = "0 "){
Testrunner. runteststepbyname ("init ")
} Else {
Testrunner. runteststepbyname ("Run ")
}
Countprops. setpropertyvalue ("count", "1") 6. perform the test:
Open loadtest, disable init and run (exechandler controls the execution of init and run), set the parameters, and OK to start running. As you expected, the init method will be executed only once, and run will be executed according to the method you set.

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.