This is a migrated thread and some comments may be shown as answers.

How to code steps

3 Answers 115 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Cilistan
Top achievements
Rank 1
Cilistan asked on 20 Feb 2013, 11:28 AM
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

3 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 20 Feb 2013, 04:07 PM
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
0
Cilistan
Top achievements
Rank 1
answered on 27 Feb 2013, 10:48 AM
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

0
Boyan Boev
Telerik team
answered on 28 Feb 2013, 02:00 PM
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
Tags
General Discussions
Asked by
Cilistan
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Cilistan
Top achievements
Rank 1
Share this question
or