How to simulate 20 users click a button at the same time in Web GUI Test Automation - testing

Now I hava a requirement about Web GUI TA
I want to simulate some users(20-30) click a button at the same time and evaluate the performance of Web GUI at that time.
I use RobotFrameWork + Selenium library to do the Web Gui TA before, but as far as I know. selenium library only can handle one broswer at one time, so i dont know how to do now.
Can you give me some advice? need use another library or framework?

Like mentioned by other, what you want to do in this case is not UI testing but rather stress/load testing. You should be able to try easily Gatling. First you record the http request associated with the click on your button. Then, you write a simple scenario that launches this request 20 times at once. Something like:
setUp(scn.inject(atOnce(20 users)))
.protocols(httpConf)

Selenium has a "grid" option you can use to configure many instances running many browsers.
http://www.seleniumhq.org/projects/grid/
http://www.seleniumhq.org/docs/07_selenium_grid.jsp
Grid allows you to :
scale by distributing tests on several machines ( parallel execution )
manage multiple environments from a central point, making it easy to
run the tests against a vast combination of browsers / OS. minimize
the maintenance time for the grid by allowing you to implement custom
hooks to leverage virtual infrastructure for instance.
In short, you create a "hub" that manages things, then each "node" can perform tests as required by the hub.
Consider, however, this may not be the best route to go down. Something like multi-mechanize might be more useful: http://testutils.org/multi-mechanize/
That will allow you to have many users "clicking" the button, but not via a browser but via direct HTTP calls. That might be more suitable for multi user simultaneous "headless" load testing, which is what I think you are attempting to do.

I'm slightly confused at this question:
Are you wanting to test the GUI? If it's something like "This button makes a dropdown menu appear", then it doesn't matter how many users do it at the same time, it'll either always work, or never work.
Are you wanting to test the server under load? If so, then Selenium will work, but there are better tools. I have used JMeter with success, but there is a really good listing of all of them here: http://performance-testing.org/
Finally, are you wanting to press 20 different buttons on the same page on the same browser at the same time? If so, this isn't possible with selenium, and it isn't a standard use case either.

Related

Is it possible to test a scenario where many distinct users are logged in simultaneously in TestCafe?

I am writing a web app where many distinct users will be logged in and interacting in real time. Is it possible to use TestCafe to test such a scenario?
I don't know your specific needs, there might be some problems that are difficult to foresee now. However, TestCafe supports multiple browser windows, so it should be possible to use multiple windows where there are different users logged in each window.
Some details about that could be found in the documentation here.
I always recommend trying out the chosen technology first on a few cases before going with it for good. You can pick out a few test frameworks like TestCafe and see what suits you best in your context.

How to test frontend app step by step by scenario?

We have a web project and the main business flow is going through the chain of processes (conveyor). We don't have any automatic tests for front. So, to test we use our "hands".
What I want to do is to create some auto test that goes through every step and every window that I do always using hands from my browser.
Any suggestions?
P.S. I don't have an access to frontend app. All I have is the running app on my browser :)
In my experience with quizzes/wizards, such using gamification logic and transitioning from screen to screen - I had to properly plan my efforts.
test that goes through every step and every window
Is easy to go way overboard with all possible paths, resulting in combinatorial explosion. As general advice, try limit the really critical scenarios and cover first those. It is quite likely that the conveyor engine, follows same basic (business) rules and just combines them to produce the flows. In other words, bugs are most likely to be found in the codified domain logic, than the mechanics behind them.
Since this is an Angular app and we all know how pesky Selenium is with it. I would go with Protractor as it is built to handle
native events and browser-specific drivers to interact with your application as a user would
and
supports Angular-specific locator strategies

How to set manually opened browser as Selenium webDriver

I am working on automating a web application.
I have many pages like login page etc. and I have many tabs. Each tab will open different page, for example, if I want to open page3, I have to go through page1 first then page2.
Here my problem is If I want to test some functionality on page3, then I have to go through all pages. It is taking so much time to test single functionality I need to spend so much time.
Is there any way I can set already opened browser as Selenium WebDriver?
Unfortunately, no.
This is the most starred feature request on Selenium as of now (February 2013, current Selenium 2.30.0). It's also one of the oldest.
http://code.google.com/p/selenium/issues/detail?id=18
There has been some work on Firefox for this, but it's undocumented, very experimental and no changes have been seen on it for quite a while. For more information, look at the linked feature request.
Front-end automation is hard, Selenium can only do what a normal user could do. The best you can do is to run the tests in parallel on many remote machines.
No... It is not possible....
In order to reduce the manual execution, we are moving towards automation.
Inbetween you cannot automate.

Testing progressively enhanced features with Capybara

I'm using Capybara to test features on a progressively enhanced website. Let's say my feature is to navigate around a hierarchy of locations. The non-javascript version involves getting a new version of the page when we click around on different locations. The enhanced javascript version opens up hidden elements, or loads up new information via Ajax.
I start by writing a test for the non javascript version, which looks something like this:
When I visit the page for "UK"
And I click "London"
Then I should see the information for "London"
Using the default mechanize driver, the test fails, I develop the feature, then the test passes.
I then create an identical test for the javascript version, flagged up with #javascript. It runs the test with the javascript driver, and that test passes because the feature has been implemented. (It's running through the non-js flow). However, I want the javascript version of the test to fail at this point because the feature has not yet been enhanced with Javascript.
So I'm looking for a good strategy for determining whether or not a whole new page has come from the server, and making sure both versions of the feature work. (I plan on integrating this with pushState so testing for a changed URL won't do)
I'm interested to hear other peoples opinions on this - I'm not convinced Cucumber is the right tool for the job, since you're describing features from the perspective of user interaction, and it sounds like your implementation of progressive enhancement will result in essentially the same user interaction.
That aside, I think you may want to consider building in some kind of testing hook to the page itself to help with this. Hard to say what without knowing your exact situation, but maybe one of:
The script-enhanced version of the page could add some element to the DOM, indicating that the enhancements are active, or indicating that the data came from an AJAX request rather than page load.
You could generate a random page identifier (from the server) on every load (e.g. new GUID), embed this into the DOM and assert that it hasn't changed after the interaction (on the enhanced version). This would be a very simple way of achieving your stated goal ("determining whether or not a whole new page has come from the server")
Why does your javascript "enhanced" version work the same as your non-enhanced? Your cucumber tests using #javascript should be testing to ensure the enhancements work.
For instance,
* if the javascript opens a modal dialog instead of following a link to a new page, test for that.
* if the javascript submits a form and updates a value, test for that.
These tests would fail if run without javascript support.

What's the simplest/easier way to do a health check/smoke test in an internal web app?

I have an intranet web application and I would like to do a simple health check/smoke that runs once an hour to make sure that everything is how it is supposed to be.
The tests are supposed to do some requests and check response for text and in some cases do one or two POSTs to see if the application in answering like it should.
I thought about using Selenium or Visual Studio's WebTest and schedule the run via CC.NET or another CI application but seems like a big shot for a simple thing.
Any ideas?
Thanks
Selenium is a good option. So is PhantomJS.
I dare to say that SWAT could be a good choice for you. It does exactly what you say - makes various http calls and check data returned, also it is possible to pass the test results to different report systems, using TAP format which swat is compliance with. And finally there is a simple DSL to write such a checks.
Regards, the author.