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

redundant data

1 Answer 82 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shreeraj
Top achievements
Rank 1
Shreeraj asked on 25 Feb 2013, 10:15 AM
Hey i want to test a web application in which i have to add new user.
Now when i record the test i fill all the text boxes with its input and new user is created .

so now when i run this test again the same user get created so there now there are 2 users with same name now as much time i run a test redundant user are been created of same name.

What i do is, every time i create a user than delete that particular user and than run the test again so there is no data redundancy is there a way where i can run a test with out data redundancy.

1 Answer, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 26 Feb 2013, 10:09 AM
Hi Shreeraj,

Thank you for trying Test Studio.

There are several possible solutions how to create a different user every time.

1. Data Driven Testing, it is a testing methodology in which the same sequence of test steps are performed repeatedly using a data source to drive the input values of those steps and/or the values to expect when performing verification steps. 

You can put as much as you want names in an Excel file or in the local data of the Test Studio. Now it will use a different name on every iteration of the test.

I recorded a short video as a demonstration.

2. You can implement a code into a coded step which will generate a random string. Then you can use that string for the name of the user. Here is a sample code:

Random randomGenerator = new Random();
string userName = string.Empty;
string
letters = "abcdefghijklmnopqrstuvwxyz";
int maxLetterNumber = letters.Length - 1;
for(int i = 0; i <= 7; i++)
{
userName += letters[randomGenerator.Next(0, maxLetterNumber)];
}
 
Pages.YourApplication.TextBox.Text = userName;

I recorded another video as a demonstration.

Hope this helps.

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
Shreeraj
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Share this question
or