I was creating a multi step web test in Visual Studio, for use in running in Azure. I needed to extract a request value for use later in my test. I could not seem to find a concrete example of how to do this. Here’s what worked for me:

When creating a Web Test in Visual Studio, you can create an extraction rule. One example where this is useful: If you want to issue a request and capture the response into a variable for use later in the test. To actually use this captured value and bind it to a subsequent request, use the syntax {{myVariableName}}.

Here is a screenshot of a specific example, where I want to capture a value into the variable “bearer_token”, and use that later in the test.

extraction-rules

Now, the extracted value for “bearer_token” is dynamically added to any headers in place in the binding syntaxt {{bearer_token}}

So there you go, a simple example of using an extracted value later in the test.