Im reading The Rspec book and in that book, they are using webrat with selenium.
I wonder if its possible to use selenium directly for integration tests in Rails instead of using it through webrat?
What are the pros and cons with each way?
Im reading The Rspec book and in that book, they are using webrat with selenium.
I wonder if its possible to use selenium directly for integration tests in Rails instead of using it through webrat?
What are the pros and cons with each way?
It is most definitely possible to use Selenium by itself. I recommend installing the Selenium IDE plugin for Firefox. This gives you an easy scripting layer to automate clicks and that sort of thing. By integrating Selenium with Rails, you can execute integration tests from the command line, which is nice for a number of reasons: other developers on your team can run them more easily, you can run the same tests against multiple browsers more easily, and you can run the tests from a continuous integration server (that can launch a web browser).
We use Cucumber with Capybara for our integration tests. Webrat does not support JavaScript, so if you click a link that has a click event handler for example, the handler won't fire. Capybara knows Javascript so will fire the event handler. Selenium would let you do this as well, but we already use Cucumber and I prefer Cucumber+Capybara tests to Selenium because it is more integrated and the tests are easier to maintain.