Automation test for SOAP services? - web-services

In our architecture we have mule application with a list of webservices, we use jenkins for continuos integration/deployment.
No automation test at all at the moment, only few unit tests.
I was thinking to add a step after each deploy to test all webservices, something like:
input: url and request body
output: check the response code, than the response body
my questions are:
Should I use a framework to integrate in our code?
Is a simple file with the list of the webservices and a file for each
response/request a good idea to do that?
which tool do you advise me?soapui?Can I do everything I need with the free version one?
should the test be ran after each deploy?
Any advise or thoughts on that?
UPDATE:
at the moment I created a file in the sourcecode with the list of all endpoints. We are integrating it in jenkins after every deploy. We only check the return code 200 for now.
Thanks

Related

How to mock SOAP web service without SoapUI

I have a web service that I want to mock in following way: I will have a list of given IDs, and a set of response items for them, and if user will send a request with ID from the list, proper response should be sent back.
How to do it without tools like SoapUI (I don't want to install any additional software on the server that will be tested if possible).
Thanks in advance for any help.
SoapUI open source provides exactly what you want to achieve, without any need to install SoapUI on the server.
I consider this approach very efficient:
Create your mock service inside SoapUI.
Test the mock on your computer with SoapUI.
Create a WAR with the mock service (or more services) - just click on the project and choose "Deploy As WAR"
Deploy the WAR to the target server.
The resulting WAR is standalone and you do not need to deploy any other software.
I recommend this tutorial: https://www.soapui.org/soap-mocking/getting-started.html
Regards,
Karel
The easiest way I could find is https://www.mockable.io/ . Hope it helps.
You might have to build an actual mock for this.
This could range from just a different implementation for an existing interface (say IOrderQuerier, with the old OrderQuerier and the new MockOrderQuerier), to a different project altogether (say MockOrderApi).
In both scenarios, the Mock would just return a set of predefined values depending on the input, but you'll need to provide some sort of switch mechanism (for example a flag in the config file, which is read by the DI container).
You'll have to provide more details about the server if you need more targeted answers on this.
If you can manage to mock this using mockito, I've just added a simple project which does most of the heavy lifting: mockito-soap-cxf

Automating the Webservice Testing

I am completely new to webservice testing.
I want to Automate the whole webservice testing part using a framework.
For eg : i have been given with a webservice say "10.0.0.191:8082/test/login" and now i want to test its input and output result and validate it BUT with developing an automation script which does it for me.
Say, like Selenium or cucumber which automates the complete website. theres this Run button which starts the automation test and at the end gives me the report.
I want to develop something like this and i have no idea which framework is used and how to approach it.
Please help and Sincere Thanks in advance for your replies.
You need to create a webservice client and test the responses. The framework is little complicated as it will require you to know about the webservices.
We use RestTest (author)
https://github.com/rawoke083/RestTest
Just dump all your service endpoint in a file with test conditions
#my.api.tests.txt
#http-method | endpoint | expected http return code | *optional text in response body
#example to test for 200 code and text "user-ok" in response with HTTP-GET
get|http://api.example.com/user?id=123|200|user-ok

want to test webservice with batch run

I am newbie to webservice testing with Soap UI. I've done with my testing in Soap UI. It followed with giving dynamic input parameter to the request, dynamic header and value, dynamic end point url and some property transfers. Now i want to do the same testing with out using saop ui tool. I want to go with batch script (or any other) running. Is there any way to accomplish this? Thanks in Advance !
SoapUI provides testrunner.bat that can be used to run the tests of a SoapUI project. It is located in the bin folder of the SoapUI installation.

BDD when testing a web service / API

I am still trying to totally understand BDD and I am facing some doubts.
From my little experience, I have been using it to automate user acceptance test and I would like to know if it's possible to use it to test a web API, without UI.
In the past I've used BDD using the given-when-then jargon and mapping the steps to UI interactions. I've done this with Specflow in ASP.NET or cucumber/capybara in ruby on rails.
So for example we could have scenarios like this:
Given I am in the home page
When I click login button
Then I should see the login page
The current project I am working at is different. We are implementing an API based in web service which would be consumed by different type of clients. Like an iphone app, android app and an asp based web client. So our main focus is based in the back-end and just that.
In this case, the tests can't be faced from the UI point of view. So our end-to-end tests are based in our service endpoints. We pass some input arguments to a service calls and check the outputs.
Can we do this using BDD? Is this right?
or maybe it would be better to use a different thing like FitNesse?
Hmm.. is using FitNesse doing BDD?
I think you can do what your writing about in BDD. I'm not sure if those 2 links about testing of webservices with SpecFlow will help you but take a look on them if you haven't seen it yet.
http://codedetective.blogspot.co.uk/2012/10/testing-webservices-with-specflow.html
http://www.creamdog.se/blog/2011/02/24/webservices-automated-tests-using-specflow-and-babelfish/
Have a look at Karate, web service testing framework by Intuit. It's recently being open sourced. It has the capability of handling API dealing with HTML, JSON, XML, GraphQL queries and is built on top on cucumber.
Simple intro here : https://medium.com/blueprint-by-intuit/karate-web-services-testing-made-simple-366e8eb5adc0#.qnpy5gagt

Create SOAP message from WSDL using axiom

I'm a starting a project which consist in sending a request to a web-service (which is already available) and parsing the response. I have the WSDL and URL endpoints. Does anyone have a startup tutorial on how to build something from there?
I would like to use Axis2 + Axiom to send the service request and receive and process the response. I'm using eclipse as dev env. I've been search for a tut on how to do this but with no success.
Any suggestion would be greatly appreciated!
this might help you
creating a webservice client using eclipse
I don't know about Axiom, but SOAP UI is a terrific tool for testing web services in just the manner you describe.
I don't know if Eclipse has a plug-in for it. (They do for everything else.) IntelliJ supports it, so that's how I use it.
Well in conclusion, I did find two very useful links for the Apache axis2 project, got it working in no time!
A deep explanation Invoking Web Services using Apache Axis2:
http://today.java.net/pub/a/today/2006/12/13/invoking-web-services-using-apache-axis2.html
For code generation from WSDL:
http://axis.apache.org/axis2/java/core/tools/eclipse/wsdl2java-plugin.html