Limit the iteration of Data Driven test
-
Thursday, March 24, 2011 10:25 AM
I have 5000 row in my coded UI datasource.
I just want to run test for any few records from that data source.
so, How can i limit the no of iterations.
All Replies
-
Monday, March 28, 2011 2:38 AMModerator
Hello Dexter.ce,
Welcome to the MSDN forum. My name is Shane Hu.
I see your requirement in detail, and I create a coded UI Test to repro your requirement. I do not know the type of data source on your computer, on my computer I create a database. Now I give you some steps here:
1. Create a new table in the same database, whose structure is the same as what you are using in Coded UI Test now.
2. Move some of the data that you want from current table to the new one, for example, you can use “insert into Tablename2 select field1,field2 from TableName1 where condition” to achieve this step.
3. Modify the connect string in developing environment: modify the table name fellow by database name as the new one as follows:
[DataSource("System.Data.OleDb", "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\DatabaseTest.accdb", "myTab", DataAccessMethod.Random), TestMethod]
4. Next please run coded UI test again, then you can see what you want.
I hope this information can help you solve this requirement, if you still have any questions, please let me know.
Best regards,
Shane
Hualiang Hu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

-
Tuesday, March 29, 2011 5:29 AMModerator
Hi Dexter.ce,
Is this issue solved? if you still have any questions,please let me know.
Best regards,
Shane
Hualiang Hu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

-
Tuesday, March 29, 2011 6:39 AM
Hi Shane
I appreciate your reply.
but what my requirement is
if i give 1st to 10th row then it should run test for just those 10 records.
i should be able to give any no of sequential records like 1 to 10, 54th to 68 so on and so forth.
in your solution what happens is every time i have to manually extracts those many records,isn't there a way to achieve this.
Thanks for your concern.
-
Tuesday, March 29, 2011 9:22 AMModerator
Hi Dexter.ce,
I am Shane. I try to find a way to update the datasource in coded UI Test,I failed,but I find another method to solve this requirement.
You can use C# or other kinds of developing environment to make a program, which can move the data from table1 to table2. The surface of this program is determined by your requirement. For example, you want extract the data from number 1 to number 10,you can use two text control(begin number and end number) and one button(OK). You can make programs accoring to the steps I mentioned before,the program trigger them when button_click(click the button OK) event occurred. So,when you want to extract data, you can run this program and input the begin number and end number, next click OK button(the data has been moved from table1 to table2), then you can execute the coded UI Test to see what you want.
I hope this information can help you solve this requirement. If you still have any questions,please let me know.
Best regards,
Shane
Hualiang Hu [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

-
Tuesday, March 29, 2011 9:31 AM
I got your point.
and VSTS framework doesn't support to specify the number of iterations?????
can u please tell me how to do the same thing with excel data source.
Here is my psudo code.
[DeploymentItem("a.xls")] // Copies the file to the deployment directory [DataSource( "System.Data.OleDb", // The provider "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= 'Path\\a.xls';Persist Security Info=False;Extended Properties='Excel 8.0'", "a$", // The table name, in this case, the sheet name with a '$' appended. DataAccessMethod.Sequential)]

