using selenium htmlunit with load tests - selenium

Has anyone used HTML unit with TestNG invocation count and thread pool size? I drive all my Selenium2 tests with TestNG and have been playing around with running HtmlUnit tests in multiple threads as a light load test.
It seems to work almost too easy so I'm wondering what's the catch? Has anyone tried it?

Related

Fitnesse getting stuck while triggering it from java and selenium webdriver

We have a requirement where in we need to trigger fitnesse test from our java + webdriver code.
While doing so most of the the times fitnesse gets stuck/freeze and the fitnesse test never executes.
Has anyone faced this issue before?
Any solution would be highly appreciated

Fitnesse: integration with Selenium WebDriver

I am working on a Selenium WebDriver project, written using the page object pattern.
I wanted to know whether is there any way in which I can integrate FitNesse and Selenium WebDriver project?
I know FitNesse can be used with Selenium IDE, however, I have no idea whether is it possible to use Fitnesse with WebDriver.
You sure can, it's just Java after all. One example of such a project is (my own set of FitNesse fixtures): https://github.com/fhoeben/hsac-fitnesse-fixtures.
You could use my fixture (BrowserTest) to execute the test. Or only use the web driver setup fixture (selenium driver setup), which also also the setup to be overridden in a CI environment, and do your own thing with web driver in a custom fixture.

Selenium - Update to WebDriver

I am using "selenium-server-server-standalone-2.44.0.jar" jar file to run my test suite in selenium test runner. It runs well in firefox & chrome, but it gives this info text in the test run report
"info: Selenium 1.0 (Core, RC, etc) is no longer under active development. Please update to WebDriver ASAP"
How do i update to webdriver manually? or How can i get rid of this info text?
The info message you are seeing is essentially warning you that if you continue to use the Selenium RC API, your tests can stop working with more recent releases of browsers. In the upcoming Selenium 3, the RC API will be dropped outright.
There is no way to just get rid of the text, it is a warning message, and it is a valuable warning message.
In order to move on to WebDriver you will need to rewrite all your tests. A suggestion is to start with failing ones first. Start by reading through the official documentation. There is also a link from there pointing you towards more specifics. While you are at it, you might also want to consider refactoring your code to use PageObjects, which was not available in Selenium 1.
Note that while you are migrating your tests, it is quite possible to run a mix of WebDriver and RC tests in the same project.
Point is WebDriver is half finished kind of thing and people not that deeply testing websites, it was useful to have IDE and automate quickly, so this selenium 1.0 works much better and should not be disabled at any point.

Running multiple Selenium tests at the same time

I would like to run multiple Selenium Tests (on a Jenkins server) at the same time.
It currently runs only a single test at a time cause ChromeDriver seems to communicate over a special port. So somehow I guess I have to pass some kind of port settings via Selenium to the ChromeDriver to start up multiple tests.
The Selenium website unfortunately is empty for that topic:
http://docs.seleniumhq.org/docs/04_webdriver_advanced.jsp#parallelizing-your-test-runs
From my point of view it makes no difference if the Test runs locally or on Jenkins, the problem is the same. We need to somehow configure ChromeDriver. The question is just how.
Anybody has some ideas or pointers where to look at and what files are involved to get this done?
You can run multiple instances of chromedriver locally quite easily, just instantiate multiple driver objects, chromedriver will keep the profiles separate and find a port to run on all by itself.
Here a link to an example that can run multiple tests using TestNG and Maven:
https://github.com/Ardesco/Selenium-Maven-Template
Just clone the above project and run the following in the command line:
mvn verify -Pselenium-tests -Dbrowser=chrome -Dthreads=2
It takes advantage of TestNG's ability to manage the thread pool and will open up multiple instances if specified. You can do the same thing with jUnit but you'll need to write a custom test runner to fire the tests off into individual threads.
If you decide to use gradle it can deal with managing the thread pools for you with both TestNG and jUnit and a lot of people prefer it to maven.
This is an old question, but for anyone still reading along, it is very possible to run multiple Selenium WebDriver instances in parallel without using Grid. I have successfully tested this using Chrome, FireFox, and PhantomJs (up to 5). Each WebDriver instance uses an isolated context, so session conflict should not be an issue. Be wary of server side conflicts though, depending on the requirements of your website!
For NUnit users, NUnit 3.2.1 now has a 'TestContext.Current.WorkerId' property that will allow you to isolate one WebDriver instance per NUnit worker.
Running multiple browsers on the same machine will often hinder performance, so be careful not to use too many browsers instances, or you may actually increase your testing time!
What you are looking for is Selenium Grid 2.
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.
I agree using grid in combination with Maven parallelized class, you can run multiple instance in one PC. Jenkins is possible when you are using Ant for your build ,then you can specify which test can be run parallel.
Its quite easy to set it up though ;)

What's the advantage of using Capybara while I'm using Selenium 2 and Cucumber for functional testing?

I'm writing functional tests for a chrome app written entirely in javascript. I decided to use Cucumber and Selenium Webdriver and run the tests on chrome. Wrote Selenium code inside Cucumber step definitions and it works fine (I've only just begun though).
I see that I can do headless testing with capybara (or webrat) and I'm not interested in that. Is there anything else that I'd gain if I use capybara?
I recently had the same question. Capybara gives you a pretty nice DSL to interact with the DOM for one thing. Another big advantage is you can easily switch drivers. On my team, we constantly switch from the Chrome driver (desktop browser) to the iWedbDriver (mobile safari in iphone simulator).
Headless testing is generally a very good thing, since the tests run faster if they don't have to draw the browser window. If the tests run faster, then you'll run them more often. If you're not interested in that, you're making a big mistake.