Reputation: 14919
For integration testing I want to use selenium, also for my TDD/BDD workflow but also for my remote build server to run through the tests etc.
What components do I need for this?
I know there is a browser add-in, but that is for helping to bootstrap the code (you can export the code, then tweak as necessary).
I find it slow to run the tests locally as it fires up the browser, is there a way to do this w/o the browser opening?
How does this work on the build server, is there a headless mode?
Can someone outline the various selenium tools and how they fit together and where they are used in the development cycle.
e.g. I see selenium drivers, selenium rc, browser add-on etc.
I want to use this for both rails and java.
Upvotes: 0
Views: 150
Reputation: 10750
I never tried Selenium with Java, only with Ruby, but your interaction should be similar. I don't think Selenium has a headless mode, you would have to use a different driver for that. For ruby, there is capybara-webkit, for example, which runs a headless webkit based browser.
I can tell you from my own experience, we had a lot of problems on CI (build server) with the headless browser so we ended up switching back to Selenium and Google Chrome running on top of Xvfb, which is kind of a virtual screen manager for unix that lets you run graphical apps in a headless environment. Most of the problems are related to inconsistent behavior between the webkit headless browser and an actual real driver. However, depending on how your app looks like and how you're going to drive it, it might work for you, you should give it a try.
So the only components you need are the Selenium server (that driver the browser) and the client, that sends the command to the server. They have java and ruby clients, so you can choose whichever language you prefer.
It is indeed a slow process and very flaky as well, as your tests might fail for no reason sometimes due to timeouts, 3rd party APIs that are down, etc. There are tons of things that can go wrong and cause your integration tests to fail.
Anyways it is still an invaluable tool and you should definitely use it. Just be aware that you should not rely entirely only on these kinds of tests to assure the quality of your app, however, these should only test a smaller surface of your system. Unit and component tests should make up the majority of your test suite.
Hope this helps clarify your questions.
Upvotes: 1
Reputation: 2564
I have evaluated Selenium somewhat myself and as I understand it you should use the Firefox add-on to record your tests. Then export to whatever code you want. Then, when the time comes and you want to test your system, boot the Selenium RC which acts as a server that you can then use to run your tests. The Selenium WebDrivers are part of this and allow the server to open and "drive" the browsers using your recorded tests.
Note that recording tests in browsers other to Firefox is more difficult as there is no handy add-on for use. Instead you have to build your own tests from scratch, which is time consuming.
app.test from Fabasoft (http://www.apptest.com/en/) is another free alternative that does the same job but in a different way, maybe take a look at that before you get too involved with Selenium.
Upvotes: 0