locked
Data Driven Unit Tests on Selected Data Rows. RRS feed

  • Question

  • How can I run my data driven unit test method on selected data rows instead of all data rows of a table?

     

    For example, I want to debug unit test for failed data rows.


    Tuesday, April 26, 2011 8:09 AM

Answers

  • Hi Rajesh,

    You can add an additional column in your datasource, for example Run with values Yes/No

    Then in your unit test, you can the code within this condition

    if(this.TestContext.DataRow["Run"].ToString() == "Yes")

    Thanks,

    Anuj

    Tuesday, April 26, 2011 6:09 PM

All replies

  • Hi Rajesh,

    You can add an additional column in your datasource, for example Run with values Yes/No

    Then in your unit test, you can the code within this condition

    if(this.TestContext.DataRow["Run"].ToString() == "Yes")

    Thanks,

    Anuj

    Tuesday, April 26, 2011 6:09 PM
  • Hi Anuj,

    I have solved my problem by creating a dynamic view on selected rows.

     

    Thank you,

    K. Rajesh

     


    K. Rajesh
    Tuesday, May 10, 2011 5:09 AM
  • Hi Anuj,

    This works, but the TFS database and local test results are saving these false positive scenarios. Is there a way to abort test before it records a result? Or better yet, is there a way to get another DataAccessMethod besides Random and Sequential"?

    Thanks,

    Micah

    Thursday, March 6, 2014 5:23 PM