Test using random email address

13 posts, 2 answers
  1. Wade
    Wade avatar
    25 posts
    Member since:
    Oct 2014

    Posted 09 Mar 2015 Link to this post

    Greetings,

    I need to test a page for a free sample. However, each email address can only be used once.

    How can I generate random email addresses to run this test?  I saw another article related to this, but the links in the article were broken.

    Thanks

    Wade
  2. Wade
    Wade avatar
    25 posts
    Member since:
    Oct 2014

    Posted 09 Mar 2015 in reply to Wade Link to this post

    This is the other post I saw.

    Other post
  3. Wade
    Wade avatar
    25 posts
    Member since:
    Oct 2014

    Posted 10 Mar 2015 Link to this post

    Anyone?
  4. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 12 Mar 2015 Link to this post

    Hello Wade,

    You can create a list with preset emails and use our data driven testing feature.

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  5. Wade
    Wade avatar
    25 posts
    Member since:
    Oct 2014

    Posted 12 Mar 2015 in reply to Ivaylo Link to this post

    I tried that and it works, but unfortunately, each email address can only be used once.
  6. Answer
    Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 17 Mar 2015 Link to this post

    Hello Wade,

    Since this is not working for you then you need to use your own coded solution with generating a random string and use it as your email address.

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  7. Wade
    Wade avatar
    25 posts
    Member since:
    Oct 2014

    Posted 17 Mar 2015 in reply to Ivaylo Link to this post

    Thanks, I'm not a programmer. I was looking for some help with that.
  8. Answer
    Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 19 Mar 2015 Link to this post

    Hello Wade,

    Regarding the coded solution unfortunately we do not have such a samples to provide, however you can always take a look over the Internet and find a suitable solution. A good starting point can be this article:

    http://stackoverflow.com/questions/730268/unique-random-string-generation

    The other solution with using the databinding is also applicable if you create a list long enough for your needs.

    Thank you for your understanding.

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  9. Wade
    Wade avatar
    25 posts
    Member since:
    Oct 2014

    Posted 19 Mar 2015 in reply to Ivaylo Link to this post

    I was able to figure it out and I posted my solution in the forum
  10. Ivaylo
    Admin
    Ivaylo avatar
    750 posts

    Posted 21 Mar 2015 Link to this post

    Hello Wade,

    I am glad to hear you have found a solution and thank you for sharing it in the public forum. This could be of a great help of other customers.

    Thank you for your cooperation.

    Regards,
    Ivaylo
    Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  11. Dee
    Dee avatar
    3 posts
    Member since:
    Nov 2015

    Posted 15 Sep in reply to Wade Link to this post

    Hello Wade.   Can you post your link to the forum post?   I am looking for a better solution.  Thanks!
  12. Jennifer
    Jennifer avatar
    11 posts
    Member since:
    Sep 2016

    Posted 20 Sep in reply to Dee Link to this post

    Here are a couple of functions for generating random character and number strings that take the desired length of string. For the string one, you can add your own combination of upper/lower letters, numbers, etc to the charSet string.

    Then in your coded step do something like this

    Manager.Desktop.KeyBoard.TypeText(randomString(7) + "@" + randomString(4) + ".com", 50, 100, true)

    or 

    Manager.Desktop.KeyBoard.TypeText(randomString(7) + "@emailprovider.com", 50, 100, true)

     

    public string randomString(int l)
            {
                //Define the length of the text
                int length = l;
                //Define the included characters   
                string charSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

                
                Random random = new System.Random();
                string randomText = new String(Enumerable.Repeat(charSet, length).Select(set => set[random.Next(set.Length)]).ToArray());
                return randomText;
                
            }
            
            public string randomNumber(int l)
            {
                System.Text.StringBuilder num = new System.Text.StringBuilder();
                Random random = new System.Random();
                for (int i=0; i<l-1; i++)
                {
                    //pick digit [0-9]
                    int digit = random.Next(9);
                    num.Append(digit);
                }
                return num.ToString();
            }

  13. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 20 Sep Link to this post

    Hello Jennifer,

    Thank you sharing your knowledge with the community. 

    @Denise, do you need further assistance on this?

    Hope to hear from you soon.

    Regards,
    Boyan Boev
    Telerik by Progress
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top