Visual Studio Enterprise 2015 or Visual Studio Ultimate 2013, gives you the possibility to test the performance of your application. In this article we'll show you how to use a CSV Data Source in order to bind data from you post parameters o string body to CSV values. It is required that you already know how to create a new performance test/record it, etc. If you don't, you can inspect MSDN documentation here.
Why should I use CSV Data Source?
You can use data binding in a Web performance test to provide values for input form posts or string body. For example we may have a list of logon emails and passwords that would be used during the execution of web performance tests to try repeated logons. Or, we can create a data source for the parts of the tests that are using the same input values. If those values will be changed, we only have to update the CSV file.
How to add CSV Data Source?
This link explains how to bind your data to a CSV file: https://msdn.microsoft.com/en-us/library/bb385971(v=vs.90).aspx.
"To add the data source to the Web test
- In the Web Test Editor, right-click the top node of the Web test and then click Add Data Source.The New Test Data Source Wizard appears.
- In the Data source name box type a name for your data source.
- In the Data source type list click CSV File.
- Click Next.
- In the Choose a CSV file box enter the path and name of the file, or click the ellipsis to browse to the file. For example, enter the following:<Your Path>\FileName.csvThe data from the CSV file appears in the Preview data pane. The first 1,000 rows of data are displayed.
- Click Finish.A dialog box appears that asks you if you want to add the file to your current project. You can use the following information to help you decide:ResponseResultAdvantageYesThe file is copied to the project.When the project is deployed, there is no extra work that is required.NoThe file is not copied to the project. When the project is deployed, you might have to update the path of the file.Some data files can be very large, and should be maintained separate from the project. Some data files must be shared among several members of a team, and should be maintained in a central location that all members can access.
- Click Yes or No.A Data Sources node will be added to the Web test, and the text file will appear as a table in the hierarchy.
- On the File menu click Save to save the Web test."
The CSV file should have this format:
- the first record represents the columns to be bind to
- the following records represents the data you want to bind
How to bind Data Source in your tests?
You can replace input posts with data from your Data Source previously added.
"{{DataSourceName.CSVFileName#csv.ColumnName}}"
Here is an example for a string body where title value was replaced with a value from a CSV file:
Happy testing and... make it green, becomes a dream :)
No comments:
Post a Comment