Thursday, January 5, 2017

Web Performance Testing with Visual Studio - Replacing Context Parameter Value with a Data Source Value

Introduction

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 replace the value of a context parameter with a value from a data source. Why do we need this? Instead using a context parameter in each web test, we can take the value from a .csv, value that can be later changed, in case we want to run tests on a different environment (e.g. site value).



Adding Data Source

It seems that binding values to Form Post parameters it is possible, but for context parameters this is not. In this case, a solution would be to:
- add a data source for your .csv file
- replace all occurrences of the context parameter with the data source
- remove the context parameter

In the example above:
- add a new data source to you .csv file (right click on webtest name + Add Data Source...), in the example this will have the name FormInputs
- replace all occurrences of {{URL}} with {{FormInputs.FormValues#csv.Site}} (right click on webtest name + Find and Replace in Request...)
- delete context parameter {{URL}}

The result should be like in the image below:


Happy testing and... make it green, becomes a dream :)

No comments:

Post a Comment

Popular Posts