In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, the editor will bring you about the advanced use of SoapUI. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
On the simple use of SoapUI, you can refer to the Internet and explore their own, not to mention here, here are some unusual uses (but very useful), plus some experience in performance testing.
File Import
Very often, there will be Functions of File Import (Upload) class. If you want to use SoapUI for integration testing, you will inevitably have to deal with the parameters of byte [] type, so how to pass the parameters of byte [] (File) through SoapUI is actually very simple, and you can see the figure very clearly.
Property Transfer
Property Transfer is to transfer data between different Test Steps of SoapUI. You can look at the document Transferring Property Values for details. Through the example diagram below, you have created a Property Transfer and added a Transfer Value, and each Transfer Value has two parts, one is Source, the other is Target, and you can choose different Step and different Property.
See an example of how to configure this content. E.g.
Suppose there is a function:send msg step in a system that requires a parameter, and this parameter is the response after the success of another Step:login, then this can be the case:
Post the configuration information you want to write:
Source
Declare namespace ns1=' http://mic2.taifook.com/'; / / ns1:loginResponse/return
Target
Declare namespace mic2=' http://mic2.taifook.com/'; / / mic2:send/arg0
Groovy
You can write some scripts in SoapUI. The scripting language is Groovy. In fact, the Groovy we usually need to use is very simple (because it is very similar to Java). Here are some examples:
E.g.1
Rand
Import static java.util.UUID.randomUUID randomUUID () as String
This is an example of using UUID as a random string, which can be used in Test Step (the above Groovy Script file is named rand)
${rand#result}
E.g.2
GetAccount
Def num = Integer.parseInt (testRunner.testCase.getPropertyValue ("count")) num = (+ + num)% 10 testRunner.testCase.setPropertyValue ("count", num + "") String [] acList = ["02-0000000-22", "02-1000001-22", "02-2000002-22", "02-3000003-22", "02-4000004-22", "02-5000005-22", "02-6000006-22", "02-7000007-22" "02-8000008-22", "02-9000009-22"] acList [num]
This is the sequence and take turns to fetch an element from a string array of length 10 (there is something wrong with the * * line. You can't get count's PropertyValue at first. You can use a line like the third line, set count = 0 and then delete, or add count PropertyValue manually. How to add it? Please google yourself), this can be used to do some performance tests of some data input (can be as different as possible), the usage is the same as above
E.g.3
InitData
Import au.com.bytecode.opencsv.CSVReader; def filename = testRunner.testCase.getPropertyValue ("filename") log.info ("[load data] CSV File Path and Name:" + filename) log.info ("[load data] Reading the CSV...") CSVReader reader = new CSVReader (new FileReader (filename)) Def isHeader = true List approvalList = [] while ((nextLine = reader.readNext ())! = null) {if (isHeader) {isHeader = false} else {approvalList.add nextLine}} / / set property to test case context def loopCount = 0 log.info ("[load data] Number of Approval:" + approvalList.size () context.setProperty ("approvalList", approvalList) context.setProperty ("loopCount", loopCount) / / get property log.info ("[loop start] Current Loop Count:" + context.loopCount) Def msg = context.approvalList.remove (0) testRunner.testCase.testSuite.getTestCaseByName ("Approval"). SetPropertyValue ("userid", msg [0]) testRunner.testCase.testSuite.getTestCaseByName ("Approval"). SetPropertyValue ("password", msg [1]) testRunner.testCase.testSuite.getTestCaseByName ("Approval"). SetPropertyValue ("key", msg [2]) testRunner.testCase.testSuite.getTestCaseByName ("Approval"). SetPropertyValue ("body", ") context.setProperty (" loopCount ", + + context.loopCount)
See, this example is very much like Java, use other Jar package (opencsv-xxx.jar, please put it in the lib directory under the SoapUI installation path) to read csv format files, and then put the read data into List and store in context, and then use getTestCaseByName to get the current TestCase (in this case, TestCase name is Approval, please note: not Test Step name), and assign values for use. Using the values here is also very simple.
${# TestCase#userid}
The example here is just the tip of the iceberg.
The above is the editor for you to share how to use the advanced use of SoapUI, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.