Understanding SOAP and REST calls The types of web service requests Agenda What is a web service? Understanding SOAP and REST calls The types of web service requests The forms of web service responses Soap UI – Overview & Features Integration with Maven and Jenkins API automation frameworks Security & Performance tests on API Demo ©1996-2016 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
What is a WebService? Bluntly speaking, when two devices need to talk to each other and exchange information over a network, the interface used to communicate between them is called a web service Typically a web service comprises of two components: a Service Provider (or Publisher) and a Service Requestor (or Consumer) ©1996-2016 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
Types of WebServices Big web services – these are largely based on the SOAP standard protocol Uses a communication language called Web Service Definition Language (WSDL) RESTful web services – which is an architectural style, whereas SOAP is a protocol Some of the examples of REST standards are HTTP (yes, our world wide web is built on REST standard), XML, URI and MIME, etc. ©1996-2014 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
Request and response Interacting with a web service is a two-fold process: we request for desired data; the service responds to our request This kind of simple interaction is called a ‘GET’ method, where the service only transfers information When there is a need for more than a simple retrieve process – like adding an entry to the Database – we can choose the ‘POST’ method that will require us to send a ‘Request Body’ along with the ‘Request URL’ When there is a need to update your data, we can opt for a ‘PUT’ method that instructs the web service to update an existing entry And lastly, when there is a need to erase data, we go for the ‘DELETE’ method ©1996-2014 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
Types of testing supported Functional, Regression, Load and Security SoapUI - Features Features Comments Types of testing supported Functional, Regression, Load and Security Data mocking Supported Multi-environment support Yes Built on top of JUnit Execution style Sequential and Parallel Types of requests/formats supported SOAP, REST, HTTP, JDBC, JMS, AMF Continuous Integration Integrates with Jenkins Supported build tools Maven, Ant and Bamboo Embedded language Groovy ©1996-2014 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
In SoapUI, the hierarchy is as follows: Project Test Suite Test Case Project hierarchy Once a Project name is entered, the new Project gets displayed in the Navigator pane. This is the area that lists the Project hierarchy. In SoapUI, the hierarchy is as follows: Project Test Suite Test Case Test Step ©1996-2014 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
Being assertive Assertions are checkpoints that decide the pass/fail status of a test step. SoapUI gives us the ability to assert the response from validating the HTTP status code to performing complex looped assertions for every entry in the response body. The assertions in SoapUI are only limited by our ability to handle the scenario with Groovy scripts. ©1996-2014 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
Integrating with Maven <plugin> <groupId>com.smartbear.soapui</groupId> <artifactId>soapui-pro-maven-plugin</artifactId> <version>${soapui.version}</version> <configuration> <projectProperties> <projectProperty>external_property=${external_property}</projectProperty> </projectProperties> <soapuiProperties> <property> <name>soapui.scripting.library</name> <value>${project.basedir}/src/main/groovy</value> </property> </soapuiProperties> </configuration> <executions> <execution> <id>*Project-name*</id> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> <projectFile>${soapuiFiles.home.dir}/projects/*project_name*.xml</projectFile> <outputFolder>${soapui.results.dir}/*project_name*</outputFolder> <testFailIgnore>true</testFailIgnore> </execution> </executions> </plugin> Adding the appropriate dependencies and the required plugins will make it easy for us to integrate SoapUI with Maven. ©1996-2014 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
Getting assisted by Jenkins – Continuous Delivery Once the POM files and properties of the separate modules are supplied to Jenkins, the builds can be triggered – just like any other build-job configuration. ©1996-2014 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
Choosing the best framework approach Rapid framework - For API with basic validations ©1996-2016 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
Choosing the best framework approach Script library framework – For API requires dynamic validations & calculations ©1996-2016 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
Test Data & Response Verification Data Script library framework architecture Test Launcher Test Data & Response Verification Data Resource Bundle Validator Result Logger Script Libraries Excel Adapter Reporting Database Data Access Object ©1996-2016 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
What else can SOAP UI do? Security testing on API Performance testing of the API ©1996-2016 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
References: http://blog.smartbear.com/apis/understanding-soap-and-rest-basics/ http://theopentutorials.com/post/uncategorized/types-of-web-services-big-and-restful/#Big_web_services http://jsonplaceholder.typicode.com/ ©1996-2016 Aspire Systems, Inc. US | UK | BENELUX | ME | IND
Recap on Verizon Q & A Capture the Web Page Traffic and store in external file format Capture the total page size, Images Sizes, JS (Java Script) sizes, CSS file sizes Need a solution that can work across multiple devices / useragents Selenium with Selenium Proxy Server Java & Test NG POI HAR Reader (Handling HAR Format) IDE - Eclipse Capturing Page, Image, CSS and JS Sizes Implemented the above approach for Desktop Browser Store the Network Traffic in the form of HAR File which can be used by Developers Code is scalable across Windows, Mac and Linux Environments ©1996-2014 Aspire Systems, Inc. US | UK | BENELUX | ME | IND