How to code steps

4 posts, 0 answers
  1. Cilistan
    Cilistan avatar
    2 posts
    Member since:
    Mar 2012

    Posted 20 Feb 2013 Link to this post

    Hi Team

    I would like to know how to update/code a step (in my test case) to generate/enter random 11 digit numbers into a Textbox.

    The reason for asking is, would like to run the same test case over and over without any duplication errors.

    Objective: To submit random 11 digit numbers without submitting duplicates

    I am using Telerik Test Studio.

    Preferable in C#.

    Regards
    Cilistan
  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1040 posts

    Posted 20 Feb 2013 Link to this post

    Hello Cilistan,

    Since .NET random generator can generate only integer random numbers and 11 digits number is bigger than the max value of integer you can use this simple code to generate 11 digits number:

    System.Random rng = new System.Random(Environment.TickCount);
    var number = rng.NextDouble().ToString("0.00000000000").Substring(2, 11);

    I recorded a short video as a demonstration against a simple application.

    Let me know if this helps.
     All the best,
    Boyan Boev
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. DevCraft banner
  4. Cilistan
    Cilistan avatar
    2 posts
    Member since:
    Mar 2012

    Posted 27 Feb 2013 Link to this post

    Hi

    Thanks for your feedback on my previous questions.

    I would like to know if you could assist with the follow:
        -    if it is possible to execute a SQL statement in a coded step using Telerik to update a database in a web test?
        -    how to list or add values in a multi line textbox field in a web test?
              (currently I am recording the steps to do this, however on playback the values inserted 1st are removed for each value added.)

    Regards

  5. Boyan Boev
    Admin
    Boyan Boev avatar
    1040 posts

    Posted 28 Feb 2013 Link to this post

    Hello Cilistan,

     
    Yes it is possible to access, read and write into database. 

    Please follow this article in order to get detailed information on how to achieve this.

    About your second question, please elaborate a bit more on your scenario.

    1. What do you want to achieve exactly?

    2. Please record a short video as a demonstration against some sample application. Jing is great for this.

    3. Are you trying to keep the already typed text and add an additional one? If so you need to do it in a coded step.

    Here is a video that demonstrates it.

    If I am missing something please provide us with more detailed information.

    Hope to hear from you soon.

    Regards,
    Boyan Boev
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top