locked
Any Event there to fire before data source initialize in data driven approach for each method C# RRS feed

  • Question

  • Hi All,

    Any Event there to fire before data source initialize in data driven approach test method for each method. All helps are appreciate .

    woodson


    • Edited by woodson.gen Thursday, March 7, 2013 1:36 PM
    Thursday, March 7, 2013 4:31 AM

Answers

All replies

  • Hello Woodson,

    Thank you for your post.

    I would like to know what Event you specify. Why do you want some events? What do you want to accomplish? And are you working with data driven unit test? Before the data driven unit test method, are there any other methods like other test methods, TestInitialize method etc? Maybe you can give us an example about your unit test to clarify it.

    I think that your issue is actually not related to test itself. If you are working with data driven unit test just with one test method, I think that there may be any events which are related to the internal engine of unit test running.

    If there are some methods such TestInitialize method and ClassInitialize method before the data driven test, these methods are executed before the data source initialization.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, March 8, 2013 4:44 AM
  • Thanks Amanda Zhu,

    TestInitialize called after data-source initialized before test method called. my  main aim is to changes the datasource dynamically of the data driven test method before test method executed.

    thanks.

    woodson

    Friday, March 8, 2013 6:00 AM
  • Hello Woodson,

    As far as I know, there is no such feature used to change data source dynamically of the data driven test method before test method executed in VS IDE.

    As my personal point of view, another workaround may be that you have to write your own task to accomplish it if you want to accomplish it.

    For example, what you may do is to define some data source parameters in TestInitialize method and select corresponding data source to connect based on the parameters.

    http://social.msdn.microsoft.com/Forums/et-EE/vstswebtest/thread/22f6022c-a1ab-4791-bcb9-2c83b33efad7

    http://social.msdn.microsoft.com/Forums/en-US/vstest/thread/4f27debf-e762-4675-aef5-849ba60bdedf

    http://blogs.msdn.com/b/slumley/archive/2006/12/15/custom-data-binding-in-web-tests.aspx

    Best reagrds,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Amanda Zhu Friday, March 15, 2013 10:07 AM
    Friday, March 8, 2013 7:53 AM