Enterprise Framework

Software Solutions in the Enterprise

How To : Visual Studio 2013 : Web Performance and Load Test Project : Web Test : Web Service : Use CSV File

Visual Studio 2013

Web Service Load Test for a Web Service Call using a CSV

  1. From Existing Solution:
    1. Right click Solution > Add New Project > Visual C# > Test > Web Performance and Load Test Project
    2. Type a name in the Name: MyWebPerformanceAndLoadTestProject
    3. Click OK
  2. Right click MyWebPerformanceAndLoadTestProject > Add > Web Performance Test
    1. In main content panel, right click WebTest1 > Add Data Source
      1. New Test Data Source Wizard:
        1. Select the type of data source
          1. Set Data source name : DataSource1
          2. Click CSV File
          3. Click Next >
        2. Select the CSV file the data source is based on
          1. Click ellipses ...
          2. Choose a CSV file.
            1. (NOTE:  Recommended that he first line is the labels for the csv)
              1. Example:
              2. UserId
                1
                2
                3
                4
          3. Click Finish
    2. In main content panel of WebTest1.webtest
      1. Right click WebTest1 > Add Web Service Request
        1. Right click http://localhost/ > Properties
        2. Set the url to the web service end point
          1. Set Url: http://localhost:64093/api/user
        3. Expand the url http://localhost:64093/api/user
          1. Right ClickString Body > Properties
          2. Set Content Type : application/json
          3. String Body > Click Ellipsis ...
            {
            "UserId": "{{DataSource1.UserId#csv.UserId}}"
            }
            (NOTE: Using {{DataSource1.UserId#csv.UserId}} will set the value from the CSV.)
    3. Click Save
Comments are closed