Using Selenium IDE with random values


Is it possible to create Selenium tests using the Firefox plugin that use randomly generated values to help do regression tests?

The full story:
I would like to help my clients do acceptance testing by providing them with a suite of tests that use some smarts to create random (or at least pseudo-random) values for the database. One of the issues with my Selenium IDE tests at the moment is that they have predefined values – which makes some types of testing problematic.

  • You must to post comments

First off, the Selenium IDE is rather limited, you should consider switching to Selenium RC, which can be driven by Java or Perl or Ruby or some other languages.

Using just Selenium IDE, you can embed JavaScript expressions to derive command parameters.
You should be able to type a random number into a text field, for example:

type fieldName javascript{Math.floor(Math.random()*11)}

Update: You can define helper functions in a file called “user-extensions.js”. See the Selenium Reference.

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.