|Genre:||Health and Food|
|Published (Last):||24 June 2006|
|PDF File Size:||20.44 Mb|
|ePub File Size:||9.38 Mb|
|Price:||Free* [*Free Regsitration Required]|
I had a requirement to capture the response from at least calls to a web service. This was to enable a manual check of the response by a non IT staff member who needed the responses in the form of an Excel file. I was able to complete this using the free version of SoapUI 4. You may also like to download Fiddler2 to check things are working. The scripting was largely a cut and paste job using code provided by M.
I have created a workspace to store my projects in called Automation. We need to ensure that the calls will get a response from the web service before we proceed so we add a soap request. In my case, the web service requires a customer number followed by a site location tag followed by one or more SalesOrders. Examine the structure of the project and ensure that the Test Steps 1 section is expanded.
Double clicking the SubmitRequestResponse shows a basic soap header. We can ignore this for now. Next is a section that creates a file from our test files directory and adds it to the fileList array. It also trims off some characters, checks the size of the array to ensure some files exist, then adds the array to the 'context object' so the array is available to the other test steps we will create. The line ' log. Click the script log button at the bottom of the Step1 window, then click the green arrow top left to run the script.
You should see the list of files printed out. Ok so far. We have successfully read the names of the files in our request directory and displayed them. It might be good at this point to comment out the line which prints out the filenames from the array. We already have step 2, it's called SubmitRequestResponse. Rename it to ' Step2 '. We now need to drag Step2 below Step1 in the project structure, so it looks like:.
Fiddler allows you to monitor what you are sending to and what you are receiving from the web service. When you open Fiddler, it needs a little configuration in order for you to view the traffic to and from your web service. Fiddler normally listens on port , so change this to as below:. My settings are set to 'Automatic'. I had some problems with this as I was initially using SSL.
To test if everything is working, go back to SoapUI and double click your test case. This is good. If you click on the session and view the results as XML, you will see the request going to the web service in the top panel and the response from the web service in the bottom panel. We have successfully called our web service and had a response returned. We now need a step to save the response to a file. Rename it to ' Step3 '. Add the following script to the Groovy window, changing the directories to match your directory structure.
This piece of scripting gets the array from the context see Step1 , takes a file from the array, gets its name and removes the. It then gets the response that was returned from Step2 and stores it as ' response '.
There is a final section that checks the size of the array and if it is greater than 0, there is still a test to run so the gotoStepByName function says goto ' Step2 '. This was to save me grief in the future but hey the real information was from M. McDonald and Dinesh K.
Groovy Script Test Step
To try the new functionality, feel free to download the trial version of SoapUI Pro from our web site. All objects that contain properties have the getPropertyValue and setPropertyValue methods. So, you can easily get and set properties from test items by using the Groovy Script test step. As the testRunner object is not available in the Script assertion, you must use another approach to get test case, test suite or project properties:. SopaUI settings are stored in interfaces of the soapui. To set an option, pass the corresponding constant and the desired value to the SoapUI. For example, the following script sets an SSL keystore and password programmatically:.
SoapUI Assertion - Script