PHPUnit Selenium with the Grinder and GWT - gwt

I've setup a Selenium test case using the PHPUnit extension for Selenium.
I've executed the test case and it works perfectly.
Now I'd like to do some performance tests with The Grinder.
In other words, I'd like to use the TCPProxy process provided by the Grinder framework and execute my Selenium test multiple times in parallel. I'm able to record the entire Selenium test with the Grinder TCPProxy. But when I want to run the generated python script from the Grinder console, I notice that some GET, or POST requests always raise an error.
My web application is developed with GWT (Google Web Toolkit). So there are obviously lots of asynchronous requests. Is this where the problem might come from? Does anyone already has experienced with The Grinder and GWT?
All little help would be awesome.

Try increasing "wait/sleep" period per action/activity to accommodate worse case slow rpc request scenarios. If that does not address the situation then you might have add some details after digging through your errors.
Give Selenium a try as it emulates user interaction on browser and hence will not encounter XSRF based issues as you are facing with a server side approach with Grinder.

Related

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.

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.

new gwt interface automation testing

So our front end GUI is getting a large overhaul to a new GWT based application. I have been working on creating the automation scripts for the old front end using cURL in some tcl/expect scripts. As I have looking at the new app I am starting to realize more and more that cURL is out of the question for performing these web interactions and was wondering if anybody had some ideas/experience with testing a web app made with GWT??
Any help would be appreciated!!
The closest analogy to cURL tests for a static-page UI for a dynamic JS/GWT UI will be Selenium (or Webdriver) tests. Selenium tests load the page up in a real browser, including all JS, and simulate clicking on and interacting with UI elements and tests that they react accordingly.
That being said, unit tests should also be written to test the functionality of your GWT UI without having to load the page in a browser, just testing that the underlying Java/JS performs correctly. The MVP pattern aims to make this easier/quicker.

GWT test with external server

I have a server-code that's written in Python, and I have a client-code that's written with GWT. Now I want to run automation testing on the GWT against the data from the Python server.
From what I searched, people recommends using the Selenium, but I prefer to have a GWT-test that has more visibility into the client-code. That way I can verify the local database, and any data that are not exposed to the UI.
Also at this point I'm not too worried about the DOM aspect, layout, and the other UI stuff.
Is there anyway to make the GWTTest work with external server?
I've tried to search for the solution, or people with similar problem, but I couldn't find one. If this question has been asked previously, I apologize.
Thanks, KOkon.
You can use the GWTTest framework to incorporate testing some GWT components that call the server. But the tests won't be able to communicate directly with the server. If you need your tests to set up state on the server, I'm afraid you'll need to write special "for testing purposes only" RPC servers or servlets or similar to do it.
Having said that, I would (presumably like those who suggested Selenium) recommend three types of tests:
Unit tests for server components, and unit GWTTests for client components,
Integration tests for testing server code interaction with database, etc.
Selenium acceptance tests, which are "black box" - they don't have access to the innards of the GWT components.
What you could do is create a proxy servlet that gets started in the GWTTestCase embedded Jetty instance. That proxy could forward all calls to you real services in Python.