locked
VS2013 - Adding csv data source to web test dynamically RRS feed

  • Question

  • Below is my requirement to reuse web tests.

    I have multiple WPTs all of those includes login and logout requests. I want to remove login and logout requests from each WPT and create separate WPTs for login and logout. Now in each WPT I will inset call to login WPT at begining of test and logout at end of test.

    Login credentials are different for each and every WPT. Now I want to dynamically load CSV data source based on test name before test starts and read username, password from that data source and add it to context for using in called login WPT.

    I have created WebTestPlugin (used PreWebTest method) to add CSV data source file but no luck. I tried almost 4 hours on this issue but nothing worked out.

    Please help on this.


    Wednesday, October 22, 2014 2:19 PM

Answers

  • Hi Varaprasad,

    If you want to add CSV file as data source based on test name before test starts and read username, password from that data source and add it to context for using in called login WPT, you only can do it programmatically by web test plug-in, it is very complex. You can try using

    DataSource class in web test plug-in to define the datasource and get the data and add it to test content based on this document: http://stackoverflow.com/questions/16588175/how-do-i-access-data-driven-values-in-a-web-test-plugin then use the test content to included web test.

    The following blogs also may help you: VSTS 2010 Feature: Data Source Enhancements and WebTestPlugin: AppendValueToContextParameter

    In my opinion, if you have different csv files for the parent web test which calls the login web test, I suggest adding the corresponding csv file to the parent web test manually and then use the test data to login web test parameters. It will save much time.

    If you only have one csv file as data source for login web test and want corresponding test data is used for login when running expected parent web test, I suggest binding the csv file to the login web test manually first and then include the login web test to other web performance tests. After that, you write web test plug-in to use expected test data based on the parent test name and run tests.

    Best regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.









    • Proposed as answer by Amanda Zhu Tuesday, October 28, 2014 8:25 AM
    • Edited by Amanda Zhu Monday, November 3, 2014 2:48 AM edit
    • Marked as answer by Amanda Zhu Monday, November 3, 2014 2:49 AM
    Thursday, October 23, 2014 9:14 AM