Automating the Trading Web Application using Selenium - java

Our application is 'Online Trading Platform'.
Now we need to implement automation for this application.
Is it possible to automate a trading platform which gets live streaming data.
Application is developed based on C#.Net.
If possible, how can we do it using Selenium.

Yes, As long as your application runs on Web Browser.
According to Seleniumhq.org
What is Selenium?
Selenium automates browsers. That's it! What you do with that power is entirely up to you. Primarily, it is for automating web
applications for testing purposes, but is certainly not limited to
just that. Boring web-based administration tasks can (and should!)
also be automated as well.

Like any modern application, the data, controls bound to be changed and hence captured. You may need to define some variable for example LastPrice, CurrPrice and once they are stored you can do the calculations and execute next steps.

Related

Are complex test scenarios with JMeter possible?

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

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/

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

Develop desktop applications view with HTML, as a web application

I am used to develop web applications in Java (Struts, Spring, JSP...). But now I want to develop a desktop one. I never liked to design windows in Java (AWT, Swing, SWT): too much work for an ugly interface. So I think it could be a good idea if could take advantage of my web-app skills. One option is to modify the SWT Browser and make calls to a Java function instead of HTTP requests. A very good add-on would be use of JSP. Finally, I thought that probably there is some framework or tool for this.
Do you think that what I propose is a good idea?
There is available some framework for this?
I need this for light applications. So I think that embedding an Tomcat server and using it with HTTP requests is not a good idea.
Edit: One example application could be a folder comparer: you specify two folders and the app shows you which folders and files are different. In this case, I think opening an external browser is ugly. Bloated application (with its server, MVC, etc) wouldn't be the best choice.
If you have used the JavaScript library - ExtJs - then you can use it with Adobe AIR to build good looking desktop based web app.
Building app's in Adobe AIR is also simple and elegant with the flex builder ide.
If your option goes to embed a light server, check winstone is not fully J2EE compliant but should be enough for what you need.
About the browser, I am not a big fan of swt myself, it complicates a lot cross-platform deployment, so probably worth to keep an eye on jwebpane, not quite ready yet, but probably the solution you'll need.
I wouldn't discount embedding a web server. I've done this before with a web start application embedding Jetty.
The download was pretty fast, the server starts up and you can use BrowserLauncher to immediately drive your browser to the embedded server, and hence your application. Jetty is designed to be modular and have a small footprint, so you can probably cut it down to the bare necessities.
There are several options: You can use the plugin API of Firefox and develop your app in there. You can use HTML, JavaScript, the built-in database, all the browser features and access the OS level.
Or you could try PyQt (Python and Qt) which allows to write simple applications very quickly.
[EDIT] The main problem you're facing is security: For security reasons, JavaScript apps (running in a HTML page) can't access local OS resources. So unless your browser allows you to write plugins in JavaScript (which is only true for FF AFAIK), there is no way to write an application which uses HTML as the "view" without the help of something else.
Moreover, HTML is very limited when it comes to features for applications. HTML is designed to be a "static document view" not an "application". You can do things like GMail but if you compare GMail to any real mail app (Outlook, Thunderbird, Notes), you'll see quickly that real desktop apps offer a lot more features.

Categories

Resources