Visual studio data driven unit test case - limit iteration
-
04 Maret 2012 8:50I have 1000 rows in a table in database. I need to use this table as a data source to my unit test case but don't want to run the test case for all 1000 rows.
Is there any way I can limit the number of iterations for unit test case so that the test run only for say 10 records and not for all 1000 records. I do not want to create views in Database to support this.- Diedit oleh Moss_Sharepoint 04 Maret 2012 9:44
Semua Balasan
-
06 Maret 2012 7:17Moderator
Hi Moss,
Thank you for posting in the MSDN forum.
The simple way: We can create a new data source for the 10 rows.
Another way: we can used the ADO.Net knowledge, for example, we can use it like this “SELECT top 1o from table…”, we can store the data in a new data source, then use this new data source in the unit test.
Best Regards,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
- Disarankan sebagai Jawaban oleh Jack Zhai - MSFTMicrosoft Contingent Staff, Moderator 09 Maret 2012 1:37
- Ditandai sebagai Jawaban oleh Jack Zhai - MSFTMicrosoft Contingent Staff, Moderator 12 Maret 2012 8:23
-
06 Maret 2012 20:09Thanks for your response John. I can do the query by myself but as I stated wanted to check if we can set the limit to DataSource attribute itself?
-
07 Maret 2012 4:54Moderator
Hi Moss,
Glad to receive your reply.
In the Web test, we can use the Plug-in to select the rows in the data source directly, but in the unit test, based on my understanding, it doesn’t support it. So I suggest you could use the ways provided by me in the first reply. Thanks for your understanding.
Have a nice day,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
- Diedit oleh Jack Zhai - MSFTMicrosoft Contingent Staff, Moderator 07 Maret 2012 4:54
-
09 Maret 2012 0:46
Thanks for the confirmation that it is not supported with Unit tests. I actually thought of extending the DataSource class but unfortunately that is also sealed :(
-
09 Maret 2012 1:37Moderator
Hi Moss,
Maybe the next version can achieve it. You could submit the suggestions and ideas: http://visualstudio.uservoice.com/forums/121579-visual-studio. Microsoft engineers will evaluate them seriously, thanks for your understanding.
Best Regards,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us