Hi Sarita,

chars = ("a".."z").to_a + ("A".."Z").to_a
random_string = ""
1.upto(5) { |i| random_string << chars[rand(chars.length - 1)] }
puts random_string

This will generate random string of 5 chars in length. To generate large
string change 5 to whatever length you want. The generated string will
contain both uppercase and lowercase alphabets.

Hope this helps,

- Angrez


On 1/12/07, sarita <[EMAIL PROTECTED]> wrote:

What about char values. If i want to enter a random string, how i will
generate it. As you know in most applications duplicate values'r not
allowed. So data has to be different each time we run the test. But changing
data, each time the test is run, is burdensome.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6096&messageID=17087#17087
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to