SOAP requests using Scala script - scala

I'm looking to make a soap call in order to setup information for a series of tests.
In order to do this, I want to call an established soap request. I'm using gatling for the tests, so I'd like to do the data setup with scala/gatling as well. Is this something that can be easily done, and can one of you FINE PEOPLE show me an example of how?

Related

Is there any functionality similar to "Schema Compliance" and "SOAP Response" as in Ready API in Karate? [duplicate]

Is it possible to use WSDL in rest assured, I'm looking for open source API automation testing tool. My services are in WSDL, I can use SOAPUI which will extract wsdl into separate end points. but Is there any way can we extract end in WSDL manually or else how I can use this with Karate or Rest Assured.
As the author of Karate, let me give you my point of view.
You don't need to worry about WSDL. All you need is a sample SOAP envelope as XML (plain-text) and you will be easily able to derive all your tests, complex scenarios and edge cases with that. This is what many teams are doing today, and you can refer this detailed set of examples to get a sense of the possibilities: xml.feature
Even if you have some complexities like encryption and signed-headers etc, you can easily plug them into your tests using Java-interop, look at this example in the documentation: https://github.com/intuit/karate#http-basic-authentication-example

SOAP Request: How to make multiple request messages in sequence

I have a SOAP endpoint and will be having more than 1000 request messages which have different values for the request parameters but same operation of SOAP Message. I want to execute them in a sequence if the previous request that got triggered was 200 OK?
Is there any way to do this without JAVA program? Is there any client that will help me?
I assume you already have some sort of loop in your test case that reads your variable properties from a file or perhaps Excel and feeds them into your SOAP request. Ready API/soapUI Pro gives you this functionality, but for open source soapUI you'll have to write your own Groovy test steps.
Then, you can use a soapUI Compliance, Status and Standards assertion to check you've received a valid or invalid HTTP status code and react accordingly.
Is there any way to do this without JAVA program? Is there any client
that will help me?
After re-reading the question, it seems to me you're not yet using SoapUI, though it has been tagged as a SoapUI question. It happens quite a lot on here where people are askign general SOAP questions, but tag SoapUI. BTW, Craig's answer should be accepted if you are using SoapUI.
In terms of options, you have lots....
Code. You can use Python, C#, Java, Javascript, etc. etc. to create a program that will call your endpoint. Any programming language will have the libraries to call web services. So, if you do know a language, you could use that.
SoapUI. There is a free version, which will allow you to call web services. In your question, you want to call the same service over and over with different parameters. In testing speak, this is a data-driven test. These can be achieved in the free SoapUI, but it is a fiddle. However, the full-licensed version offers data-driven tests out of the box. I use these all the time. Very easy to set-up. If you use SoapUI, then Craig's answer about using Assertions would stop the test if you got a status code other than a 200.
Postman. this is another free tool, which I have used a little. I haven't tried data-driven tests, but I'm sure the docs will tell you if they're supported. If you try Postman, then you ought to look at Danny Dainton's excellent tutorial on GitHub
JMeter. Another free tool. This is primarily used for performance and load testing, but would still meet your needs.

How to easily do an async REST request in Perl?

I am currently in the throes of writing a plugin for Bugzilla, and so all of the code needs to be written in Perl. I have everything working quite nicely, however there are a few places where I know I need to do multiple requests to the same REST server, and, given that it might be distant network wise, I would like to be able to send several requests, and then wait for them all to come back, rather than do the Stop-And-Wait Send/Wait/Send/Wait.
Using REST::Client allows for very easy access to REST client functionality, which is what I am currently using. The top Google result for perl sync rest is HTTP::Async, but this page doesn't address REST directly, and it is not clear to be how to easily use HTTP::Request to easily process them.
What is the best way to do this?
Mojo::UserAgent is a very nice web agent that does async well.

LoadUI and SoapUI and Rest API backend does not execute

I am currently using LoadUI and SoapUI for Load Testing a REST API. However each time I ran either my functional tests from SoapUI or my Load Tests based on the SoapUI project the backend code does not execute.
I expected to see the service doing what it was supposed to however nothing happens?
Is this normal behavior for Soap and LoadUI? Are they simply just simulating Load rather than executing the code?
I hope anyone can help me get out of this foggy area where I am at. Also it is the first time I am testing Web services.
Thanks in advance.

Automate Rest API test and integrate this with Continuous Integration(CI-Jenkins)

I found many similar questions related to this, but not the particular answer I am looking for. Actually my requirement is little different, so I end up posting the following issue.
I want to automate Rest APIs, and I got two options for the same case.
The first one is Rest Assured and second one is Play Framework.
For example, to test this RestAPI:
http://servername:9000/dbs/all/list/m1/p1/sch1
(↑ This gives xml response)
So, I have written a code in Java with Rest assured, and is working fine. I integrate this with Maven project so that can be integrated with Jenkins.
Sample code:
import com.jayway.restassured
public class TestNGSimpleTest2 {
#Test
public void testApi() {
expect().
statusCode(200).
body("Status", equalTo("Su22ccess")).
when().
get("http://localhost:9000/dbs/all/list/m1/p1/sch1");
}
So my first question is:
Is the rest assured is the best tool to use?
Does Play framework is better?
I found many other tool like Jmeter, RightAPI etc. to test RestAPI. But I dont think this is automable. Am I right?
For automating REST API testing, as a starting point I recommend using Postman and newman.
Postman provides an excellent UI for building requests, and newman is its command-line counterpart. After you create a set of requests and corresponding tests within the Postman UI, you can run the entire collection from Jenkins via newman, preventing a deployment if tests fail.
The RestAssured code you have posted will work just fine for basic cases. It's not necessarily the "right tool" if you want to:
continuously add new test case and don't have many resources
propogate alerts with well-formed error messages (especially to places like Slack or GitHub)
reduce false-positives
re-use the same tests for monitoring
Building these features takes time and resources which, depending on the size of your team may or may not be a good call.
Some of the commercial solutions you posted can solve some of these problems for you.
Assertible is a codeless solution that supports the workflow you described directly: https://assertible.com/blog/automated-api-testing-with-jenkins
We can integrate Jenkins and JMeter for automating RestAPI testing.
The reason for that is,
In Jenkins we can schedule our tests/builds in whichever way(every minute/hour/day/month.....) or based on the commits etc..
we can bundle n number of APIs together in JMeter and execute in a single test.(Maintaining is easy)
There is a jenkins plugin "Performance" which can be used to check the response time for each API call, which compares the response time with respect to the previous response times.
JMeter has an in-build threading feature, which helps execute tests much faster than any single threaded tests.
Screenshots:
Steps
We can prepare our APIs in JMeter
Configure the tests in non GUI Mode in Jenkins.
Install and Configure the Performance plugin in Jenkins.