Unfortunately, the format of automated tests I want to create is not supported by the Selenium IDE. The Ruby script it generates is for Unit::Test, not RSpec, which is the format I want. So over the last week I’ve gotten pretty good at generating the Unit::Test code and converting it to RSpec so we can run it in a headless grid integrated with our CI environment.
But I’d rather just export it as RSpec directly and skip the whole conversion process. As it turns out, it’s pretty easy to add a new exporting format to the Selenium IDE. So I did it, by modifying the code that creates Ruby - Unit tests so that it will create RSpec code instead. It only took about ten minutes to do, and the end result isn’t 100% perfect, but for most of the testing I do it will generate RSpec code that will run right the first time.
I know Selenium/RSpec doesn’t have a huge user base at the moment, but if anyone would like to download the file, here it is. I’m not reserving any rights to this - do what you want with it, use at your own risk. To install it, open the Selenium IDE, pick Options=>Options. Click on the formats tab, then the add button. You will see two fields, one tiny, one huge. In the tiny field, type Ruby - RSpec. In the huge field paste the entire contents of the file OVER the pre-populated stuff.
Now, whenever you export a file, Ruby - RSpec will show up as one of your choices. Cool, eh?
If you make improvements to this file, please let me know. I’d like to benefit from them as well. One of the things that would be cool is if I could create describe…do and it…do blocks from the IDE. That would probably require a combination of extensions and changes to the format.
If you enjoyed this post, make sure you subscribe to my RSS feed!




3 responses so far ↓
1 carol // Jul 2, 2008 at 11:46 pm
this is great, thanks for making the converter
2 Sam // Jul 17, 2008 at 1:24 am
How about importing an rspec selenium test into Selenium IDE? … any chance of that?
3 David Christiansen // Jul 17, 2008 at 9:57 am
Can you tell me a little about why you want to do that? Can’t you just run it with Selenium RC?
Leave a Comment