Productivity Acceleration Tools for SOA Testers

  • Published on
    19-Jul-2015

  • View
    770

  • Download
    3

Transcript

Productivity Acceleration Tools for SOA TestersEvanthika Amarasiri : Technical Lead - QANirodha Gallage : Senior Software Engineer - QA April 2013About WSO2 Providing the only complete open source componentized cloud platform- Dedicated to removing all the stumbling blocks to enterprise agility- Enabling you to focus on business logic and business value Recognized by leading analyst firms as visionaries and leaders- Gartner cites WSO2 as visionaries in all 3 categories of application infrastructure- Forrester places WSO2 in top 2 for API Management Global corporation with offices in USA, UK & Sri Lanka- 200+ employees and growing Business model of selling comprehensive support & maintenance for our products150+ globally positioned support customersAgenda Advantages of using tools for SOA testing Choosing the right tool that matches your requirement Test Scenarios - soapUI- Apache JMeter Tips on toolsAdvantages of using tools & automation for testing No need to re-invent the wheel : Reduce time of writing client programs from scratch Reduces time on frequent recursive testing Saves time to utilize the specialized knowledge effectively; i.e. to do exploratory testing Reduces test execution time : Takes more time if done manually Helps to release early & release often Reduces the possibility of missing test scenarios Ability to do dynamic data driven testingAdvantages of using tools & automation for testing Contd... Ability to do load/performance testing Can generate result summaries and reports easily Ability to integrate test suites in build systems and trigger automaticallyChoosing the right tool...soapUI - What does it support? Automated request generation : i.e. Generate SOAP request messages when WSDL is provided Ability to validate responses : i.e. assertions Support for QoS : i.e. Security, MTOM Ability to simulate service providers; i.e. mock services Ability to do performance testing Supports multiple protocols & message types : i.e. HTTP, HTTPS, REST, JMS, JSONExamples with soapUI Web Testcase support Invoking secured web services with HTTP basic authentication Invoking a web services secured with asymmetric binding policy Assertions for responses Sending HTTP chunk encoded messages Executing soapUI test suites/test cases in headless mode Testing RESTful APIsWeb Testcase support Allows to test solutions without ?wsdl Invoke simple HTTP methods; i.e. GET, POST, etc on different services within the same project. Signing SOAP messages Asymmetric binding- message security is provided using asymmetric keys E.g.: public keys.- assures confidentiality, integrity and the non-repudiationServer's public keyClient's private keyServer's private keyClient's public keyClient signs the message from his private key and encrypts from server's public keyServer signs the message from his private key and encrypts from client's public keyIncrease raw request/response size When raw view does not show large messages, configure UI settings ...... and it will increase- size of raw request messages- size of raw response messagesAssertions Validates responses Added to test steps Provides different types of assertions; assertions to be done on response message, for HTTP status codes, SOAP faultsAdd AssertionsSending chunked-encoded requests Content-Length- The length of the request body in octetsPOST /services/Axis2Service HTTP/1.1Accept-Encoding: gzip,deflateContent-Type: text/xml;charset=UTF-8SOAPAction: "urn:echoInt"Content-Length: 3782Host: 127.0.0.1:9764Connection: Keep-AliveUser-Agent: Apache-HttpClient/4.1.1 (java 1.5)POST /services/Axis2Service HTTP/1.1Accept-Encoding: gzip,deflateContent-Type: text/xml;charset=UTF-8SOAPAction: "urn:echoInt"Transfer-Encoding: chunkedHost: 127.0.0.1:9764Connection: Keep-AliveUser-Agent: Apache-HttpClient/4.1.1 (java 1.5) Chunked- Messages are sent in chunksHeadless mode compatibility of soapUI Windows testrunner.bat -s Axis2Service_TestSuite -r -f C:\soapUI\logs\response -IC:\soapUI\projects\my_soapui-project.xml Linux testrunner.sh -s Axis2Service_TestSuite -r -f /opt/soapUI/logs/response -I /opt/soapUI/projects/my_soapui-project.xml Parameter lists the test suite to runc the test case to runr prints summary reportl ignore errors and continuef folder to which test results should be savedTesting RESTful APIs Scenario 1 - Invoke Login API of WSO2 API ManagerIn which situations we can use JMeter? To simulate multiple user access/ load tests For data driven testing To analyze & measure performance of services To validate responses; i.e. assertions To create test suites with real world scenarios which involves executing multiple services sequentially or in parallel Support for different transport protocols; i.e. HTTP, HTTPS, JMS, MAIL, FTP, JDBC, LDAP etcTesting examples with JMeter(Currency conversion rate)1. Send SOAP requests to a Stock Quote web serviceScenario 1 : Testing a web service with dynamic data 2. Need to send dynamic data inputs in the SOAP request3. Read the response and verify the response is valid1. Send request to the Web Service2. Send requests with dynamic inputsStock Quote serviceTesting examples with JMeter Thread Group Sampler > SOAP/XML-RPC Request Config Element > CSV Data Set Config Assertions > Response Assertion Listener > View Results Tree Listener > Aggregate ReportScenario 1 : What JMeter components you will need?DemoTesting examples with JMeter1. Invoke Login API(Access Token)2. Invoke Stock Quote API with the Access Token(Response)Login APIStock Quote API1. Call the login API [REST] and acquire an access tokenScenario 2 : Testing API's with WSO2 API Manager 2. Use that access token to invoke the API3. Read the response and verify the response is correctTesting examples with JMeter Thread Group Config Element > HTTP Cookie Manager Config Element > User Defined Variables Sampler > HTTP Request Config Element > HTTP Header Manager Post Processors > Regular Expression Extractor Assertions > Response Assertion Logic Controller > Loop Controller Listner > View Results Tree Listner > Aggregate ReportScenario 2 : What JMeter components you will need?DemoTesting examples with JMeter Create it once.... Run it anywhere!!! All you need is a JMeter distribution a JRE installed and a command shell Linux : ./jmeter.sh -n -t /path/to/JmeterTest.jmx -l /path/to/resultsFile.jtl Windows : jmeter.bat -n -t \path\to\JmeterTest.jmx -l \path\to\resultsFile.jtl Use Shell/ Batch scripts to change test parameters and execute programmatically, for recursive test scenarios. Refer : http://nirodhawrites.blogspot.com/2012/06/how-to-run-jmeter-tests-in-non-gui-mode.htmlScenario 3 : Running JMeter scripts in 'Headless' modeTips...When sending http requests with Jmeter always select 'httpclient4' as the implementation for high load scenariosWhen doing load tests disable "View Results Tree", as it affects thread creation rate.Always keep test parameters like endpoints, IPs, ports etc as configurable variablesFor high load tests run the Jmeter tests in headless mode, and write the result to a .jtl file. You can open them later in JMeter UI, to check results summary, and performance figures.When measuring performance figures with load tests make sure only the client and server are running in their respective machinesTips...Other free external plugins are available for Jmeter Ant plugin http://www.programmerplanet.org/pages/projects/jmeter-ant-task.php Allows you to run JMeter script as an ANT task Creates reports Google plugin http://code.google.com/p/jmeter-plugins/ Generates new set of graphs for performance test Have some new throughput controlling componentsQ & AEngage with WSO2 Helping you get the most out of your deployments From project evaluation and inception to development and going into production, WSO2 is your partner in ensuring 100% project successEngage with WSO2

Recommended

View more >