0

Is there a way to build a Selenium-IDE Test-Siute so that in each run some text will be renamed?

Say I have a test-suite that creates a simple form in each run. By default, selenium will create one form with the initial name, say "form1", and in the 2nd run will get an error since a form in this name already exists. (Suppose the system does not allow 2 forms with the same names..). I'd like selenium to create each time a new form with other name (don't care if incremented or randomized..)

Thanks.

Roi Bueno
  • 99
  • 10
  • You need to give some more information. I am lost what yo are asking for! – Saifur Jan 18 '15 at 13:52
  • No problem. Suppose I use Selenium IDE to create some items inside database. Also suppose this DB can't accept that two items within it will carry the same names. Say we start to record and during the record we create some item, call it "item1" and stop recording. Everything will work fine until now. Next time that we'll try to play the record we will encounter a problem - the item name is alreay there! so the test suite will get stuck. How can we overcome this? – Roi Bueno Jan 18 '15 at 14:00
  • I am afraid but probably cannot accomplish this using selenium IDE since there is no way for that to know you are repeating this work. I would suggest you use `webdriver` and repeat this work with simple for loop(as many times as you need). In such scenario I use timestamps including millisecond which is most reliable. – Saifur Jan 18 '15 at 14:03
  • Great, thank you, I will use the "webdriver" tool. – Roi Bueno Jan 18 '15 at 14:07
  • BTW - are there other tools that have this ability too? – Roi Bueno Jan 18 '15 at 14:20
  • I would still tell you to stick with `webdriver`. You can record the scenario and do little parametrization and use to concurrently. See [this](http://stackoverflow.com/questions/19358183/how-to-convert-commands-recorded-in-selenium-ide) – Saifur Jan 18 '15 at 14:24

1 Answers1

0

I have run into a similar issue with a test that creates and saves a search. I create the name I'm going to use at the beginning of the test by using the system date/time, Like this:

storeEval | var d=new Date(); "SearchName" + d.getDate()+'-'+((d.getMonth()+1)) +'-'+d.getFullYear() + d.getTime(); | SearchName

So everytime I run the test, even if I immediately execute that line again, the name will always be different (if that string is too long, "SearchName5-2-20151423139676713", you can always just use the getTime portion, as that will be different each time. I prefer to use the entire string, as this also gives me a way to see when that record was created by the test.

  • Klendathu
Klendathu
  • 793
  • 1
  • 12
  • 20