SOAP Tutorial 1 – Functional Unit Testing

Lets start with the most basic of testing, – Unit functional Test of a SOAP service. A similar example will be done for a REST/JSON service under the REST set of tutorials. Unit tests are often done by developers as and while they are developing the service, although there are many QA groups I have met that still do unit testing only. Most of this is available in the free Personal Edition of SOAPSonar.A SOAP API offer some additional WSDL structure that aids testing without a client. If you have not installed and activated SOAPSonar, please follow this Tutorial first. For this example, I am going to use a SOAP service hosted here http://www.html2xml.nl/Services/Calculator/Version1/Calculator.asmx

1.Launch SOAPSonar using full administrator permissions.  Make sure you leave  SOAPSonar in QA mode (right hand top). In the main Capture WSDL bar enter the service we wish to capture by pasting http://www.html2xml.nl/Services/Calculator/Version1/Calculator.asmx and then add ?WSDL with no spaces and press enter.  Notice the SOAP API Calculator.asmx is now imported which as 4 WSDL Services, Add, Subtract, Multiply, Divide.

1Capture wsdl2. For those who interested in seeing the code, If you select Configuration, Documents, View Documents, you can see the Main WSDL and the Embedded Schema that you just imported. More on WSDL Scoring Report Card in later tutorials perhaps.

2 view documents

3. Lets run through a simple Addition unit test while in project view still. Under WSDL, Calculator, Add, select Add_1. Notice SOAPSonar populates a UI for you with Body a= and B= fields. Put 6 in first field and 4 in the second then round green check box “Commit Settings” and the round blue arrow “Send Current Request to Server“. Did you get a response? Was it the right response of 10? Congratulations, you just unit tested a single service using SOAPSonar as the client.

3 Response1

4. Lets try that for the other services. Select Subtract_1 and enter the same a=6 and b=4 then round green check box “Commit Settings” and the round blue arrow “Send Current Request to Server“. And Multiply_1 and Divide_1 as well. Did they all work? Did you notice that 6/4 is truncated to 1 with no decimal places?

4 Trunkcated

5. One way to add more test cases is to clone the service. This is usually used if you wish to establish separate test criteria for the service.  Right click on Divide_1 and select Clone. Do you have Divide_2 now?

5 Clone

6. Lets rename that so we remember what we doing better. Right Click, Rename and call it “whole number“. Leave a=6 but make b =3. Then round green check box “Commit Settings” and the round blue arrow “Send Current Request to Server“. Did you get 2?6 print screen

7. Now, this is slow and repetitive and a good QA tool is about saving the time taken for testing. I have 5 test cases and want to run them all together.  Select Run View and lets simply drag all 5 test cases under the default group. Then round green check box “Commit Settings” and the round blue arrow “Send Current Request to Server“.  Patient, you now running 5 test cases.

7 run view

8. Under success criteria graph, how many pass and how many failures did you get? Since we have not set up any success criteria yet, I would hope you have 5 pass.

8 Graphs

9. Select Analyze Results in Report View. Can you see the details of your 5 test cases now. Which one tool the longest to respond, what was the response codes for each? You boss wants to know what you doing. Take a moment to look under Generate Report drop down. Which of those can you send to them? How about the Detailed Functional Test Report? Notice you can export these reports?

        9 Report

10. But wait, maybe I should show more test cases. Select Run View again. Right click on Default Test and Rename it to Tutorial 1. Then right-click it again and Clone it. Rename the new Group Tutorial 2 and you ready for the next tutorial – Automating Data Sources

10 Tutorial 2

11.  Save your project file as SOAP_Tutorial and take a stretch. Yes this is not very exciting yet, but perhaps you can start thinking of how automation can save you time?

For more tutorials on how to better make use of SOAPSonar take a look at our partners site  at ST3PP’s for their series of Tutorials 

 

By : Crosscheck Networks /December 17, 2013 /All Posts, Technical Discussions /Comments Off on SOAP Tutorial 1 – Functional Unit Testing

Comments are closed.