Are complex test scenarios with JMeter possible? - java

I need to run performance tests on a web application and was wondering if the following can be accomplished with Apache JMeter.
I need to simulate approximately 300 users accessing an application over a set time frame (e.g. 300 users over 10 minutes) and doing some actions, for example:
Logging in
Navigating to different pages
Inputting data
Submitting forms
I'm quite new to JMeter and performance testing in general and was wondering if this is possible? Otherwise are there any better (free) alternatives?
Many thanks.

Of course, it is possible using JMeter.
I would recommend using JMeter/ Blazemeter Chrome extension. BlazeMeter's Chrome extension let you test your application without prior scripting knowledge. It is very easy to create a test with BlazeMeter's Google Chrome extension. Here are some blogs that will help or guide you to use Chrome extension and forth.
There is another option, that is JMeter build in Test Script Recorder. Go through This thread for further detail.
Follow any one of the two procedures to record your scenario and then customize the imported script according to your requirement.
First, record your scenario using Chrome Extension.
Import the generated .jmx file to your Jmeter.
Configure the Test plan according to your requirement.

Actually this is what JMeter is designed for.
For the basics following documentation chapters are very useful:
Building a Web Test Plan
Building an Advanced Web Test Plan
When it comes to the load distribution just use separate Thread Groups to represent different groups of virtual users (like some users are logging in, another are navigating pages, etc.). If you have only one group of virtual users and several actions to simulate you can go for Throughput Controller

Related

How to perform performance testing for webappication

I have a java web application deployed in tomcat. I am very new to automated testing.Our intention is to create a bench mark for our search page as below:
Time to load search results for 100 users at a time with simple search criteria to complex criteria, via login to the application from 100 browser instances.
can you suggest the best way/tool to achieve it. I heard about selenium and selenium Grid to incorporate parallel execution. Is this the right way.
Welcome your valuable suggestions.
You've tagged your test with selenium, but there is more convenient task for performance measurement of java applications (including web apps)..
Try Apache JMeter http://jmeter.apache.org/

Using Jmeter for load testing of a standalone java application

I have to do load test for a stand alone java application. I have just one class file can i do the testing with Jmeter ? If yes then can some body throw some light over it or share any tutorial?
Actually when i went through net, i got to know that Jmeter is meant for testing web application only but i got few blogs regarding testing of stand alone application as well but they were not very much helpful.
Please help.
To load test an application you need to apply load to it. Jmeter is used to apply load to web sites by simulating users of that web site. It won't help you very much unless you are writing a web site.
For your stand alone application you will need to work out a way to simulate lots of users (usually that will involve finding or writing another program to do so) and then do that.
For example to load test a restful web service to store documents I wrote a program that looped through every file in a folder uploading them all, then downloaded the uploaded files and compared the two. We then ran that up on multiple computers simultaneously looping thousands of times through the folder. That simulated heavy load from multiple users.
Apache JMeter may be used to test performance both on static and
dynamic resources (Files, Web dynamic languages - PHP, Java, ASP.NET,
etc. -, Java Objects, Data Bases and Queries, FTP Servers and more).
It can be used to simulate a heavy load on a server, group of servers,
network or object to test its strength or to analyze overall
performance under different load types. You can use it to make a
graphical analysis of performance or to test your server/script/object
behavior under heavy concurrent load.
via http://jmeter.apache.org/
so maybe it does not suite...

Testing traffic on a webapp (Spring, Hibernate, Java)

I am developing a webapp and am looking into how I can automate testing of the web site such as seeing how it copes with multiple concurrent users / heavy traffic. Could anyone point me in the direction of any software or techniques I could be using to help me do this?
I am also looking into how to automate testing things at the front end? For example I have unit tested all of my business logic at the backend, but them am unsure as to what I should be do in order to automate testing of everything else.
For heavy traffic testing, I've been using JMeter. For front end testing, I'm using Selenium.
Beside Apache JMeter, which generates artificial load and allows you to test performance, there are two main technologies for testing accurately performance during operation:
Tagging Systems (like Google Analytics)
Access Log File Analysis
With tagging you create an account with Google Analytics and add some JavaScript code to the relevant places of your code, that allows the browser of your visitors to connect to GA and get captured there.
The Access log file holds all information about each session. There is a data overload, so data has to be Extracted, Transformed and Loaded (ETL) to a database. The evaluation can be then performed in nearly real-time. You can create some dashboard application that does the ETL and displays the status of you application in nearly real time.
I had same need some years ago while developing a large scale webapp.
I've been using Apache JMeter as for automation testing, and Yourkit Java Profiler for profiling Heap JVM usage and actually found lot of memory leaks!
cheers
Selenium to test the flow and expected results
Yorkit to profile CPU and Memory usage => excellent to track concurrency issues and memory leaks
Spring Insight to visually understand your application performance / load +
See the SQL executed for any page request => with drill down to the corresponding source code
Find pages which are executing slowly and drill into the cause
Verify your application's transactions are working as designed
Spring Insight is deployable as a stand alone war (Tomcat / tC Server / etc..)

Can JUnit be used as an alternative to browser testing in Spring?

I'm building a Spring web app and up until now all of my testing is using a browser.
This involves starting the server, opening a browser window and checking to see if accessing any of the pages causes an error.
This is starting to get repetitive and doesn't seem to be the most efficient way to do this.
Since the Junit jar file is already in my project, could it be used as an alternative to this browser testing and, if so, any tips on how to get started making JUnit simulate the act of opening a browser to access the web app?
Take a look at Selenium. It allows you to script functional tests using JUnit or TestNG and execute them in a browser, automatically.
You can use the HTMLUnit extension to script to drive the web site from JUnit.
I used a while back and worked fine for thi site I was doing then.
see http://htmlunit.sourceforge.net/
I suggest you to try the Robot Framework. This is an open source testing framework developed by engineers in Nokia Siemens Networks.
It is primarily built on python and the Selenium testing libraries. It also includes support for testing Java/J2EE server side code through Jython libraries. I personally use it in my work sometimes, and writing a test case is just as easy as describing an end-to-end flow through the use of Keywords (most of required ones are already inbuilt). You could go ahead and give this a shot if you find Selenium a li'l tough to work with. The Robot framework provides a fairly simple abstraction over raw selenium, coupled with the power to make Java/J2EE server-side calls too.
Regards,
Nagendra U M

JUnit - testing a web site

I'm very new to JUnit, but I want to set up some tests which does the following..
Tests a range of server to server API calls - verifying the responses are correct - I can do that fine.
Open a web page, enter data onto it and verify what happens on submit - This I am struggling with. Is it even possible?
I am thinking that I could call a web page using a server side http web request, but I'm not sure how I can interact with the site itself, i.e. enter data into the forms.
Any thoughts?
Thanks
Steve
You could use Selenium for this. I suggest you use the version 2 which is currently in development and should have a beta available soon (alphas are already available).
Have a look at Selenium, it's a system to test web applications (and de facto websites) you can write all your tests in java. There is an ather project named Tellurium, based on Selenium but Tellurium works with groovy and a DSL, it might be easier to handle at first.
How does this works ?
First you create tests in java (Selenium) or groovy (Tellurium)
Then you start your tests. It will work with your web browser. The application will interact with your browser to test every inch of your application (as you coded it)
At the end it give you a report about yours tests, just as JUnit do.
You can also exploit the nature of the web. There's no real reason to render a form, fill it out and submit it to test the form processing code. The display of the form is one HTTP request, and the submission is another. It's perfectly reasonable to test form submission code by mocking up what a browser would send and asserting that it's handled correctly.
You do need to make sure that the form rendering and submission test code are in sync, but you don't necessarily need a full integration for this either.
There are tools that allow testing without booting up a browser... one that springs to mind is HTMLUnit (and there are others). If you find that Selenium is a pain to write, or the tests brittle or flakey, look for simpler tools like this.
I suggest you to try the Robot Framework. This is an open source testing framework developed by engineers in Nokia Siemens Networks.
It is primarily built on python and the Selenium testing libraries. It also includes support for testing Java/J2EE server side code through Jython libraries. I personally use it in my work sometimes, and writing a test case is just as easy as describing an end-to-end flow through the use of Keywords (most of required ones are already inbuilt). You could go ahead and give this a shot if you find Selenium a li'l tough to work with. The Robot framework provides a fairly simple abstraction over raw selenium, coupled with the power to make Java/J2EE server-side calls too.
Regards,
Nagendra U M

Categories

Resources