Selenium test for interaction between two users - testing

I need to test user chat system with selenium. Currently I do that manually by opening two browsers, logging in each with different test user, and send messages between the two users.
My question is how I can automate that with selenium?

Actually I never tried that, but I guess you can easily have two different instances of WebDriver:
driver1 = new FirefoxDriver();
driver2 = new FirefoxDriver();
should IMHO run two different Firefox browsers where you can play around. But again, I never tried this approach, so I might be wrong

Its hacky, but could you run two instances of Selenium then run two tests simultaneously?

Two drivers seems like a nice fit. If that's not possible, try using two different frameworks.
HeadlessUnit and Selenium, for example. Don't really know if they would be stepping on each other toes.

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.

Selenium Grid for stress/performance testing

Im new to using Selenium Grid so I don't really know that much about it. What im trying to do is simulate 400 users using my website. I can create the test script that simulates the users actions but im not sure how to use Selenium grid to simulate 400 users using the website at once. Any help or useful tutorials would be appreciated.
At the moment im using selenium webdriver and firefox driver to simulate one users actions. All my tests are being run through eclipse.
I think what you are looking is a Grid implementation but not using a standard webbrowser. I think what you want is to just do a multi-threaded GhostDriver test by registering GhostDrivers to your Grid nodes. You can use TestNG to fork the threads using a TestNG instance generating class factory.

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

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.

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.

TestComplete import testscenario from Selenium

Maybe this sounds ridicilous, but still, is there somekind of way to convert/import/hack selenium test scenario to get work on TestComplete?
I ask this, because my boss asked me to find a way, we are using Selenium, but our customer want us to give him TestComplete scripts, so we dont want to buy licence for 1 customer and i havent find any yet and belive there is no... maybe im missing something? Thanks you and have a nice day.
There is no direct ways to convert Selenium tests to TestComplete as these tools use different principles. Selenium works with web pages "from inside" (programmatically) while TestComplete does this "outside" by simulating user actions: it sends mouse clicks and key presses to the browser.
I think that it is possible to invoke Selenium tests from TestComplete, but you will not have any results in TestComplete and you will be unable to modify tests in it.
BTW, you can request a free 30-days trial if a month is enough for you to convert the tests.