0

I have a (non-coded) Visual Studio webtest where a required context parameter is always successfully extracted from an HTTP Response. Let's call it myParam. In my webtest, I use the context parameter to define a URI in a later HTTP Request, like so: "https://example.net/initial_path/{{myParam}}" where myParam is replaced with its value.

Here is the call where the context parameter (targetId) is successfully extracted. Required=True, so targetId gets a value or the test fails.

Extraction Rule (Must succeed)

On my laptop, this works fine, but after uploading the test to a centralized machine, the context parameter is not getting replaced with its value. In other words, the webtest (contained in a loadtest) is actually requesting the literal string containing {{myParam}}, which of course fails every time.

This is where my context parameter is used in the webtest.

Context Parameter Used in URL

And here is where it is successfully used when the webtest is run from my laptop.

Successful use of Context Parameter

We have a machine running Visual Studio inside the firewall controlling a herd of agents to fully load test our applications. When the same test is run there, the URL uses the literal string {{targetId}} instead of the value stored in the context parameter. Screenshot is from ELK, because this issue isn't a failure within Visual Studio, no logs are generated.

targetId being used as a literal string

My question is: How can I force Visual Studio to recognize my context parameter correctly? It's supposed to do this automatically.

DRosser9
  • 1
  • 2
  • (1) What does *"On my laptop, this works fine, but after uploading ..."* mean? Please [edit] the question to explain that in more detail. (2) Please show the actual code, not something you have just typed to be similar. (3) Is the extraction rule successful when the (bad) URL containing `myParam` is sent? (4) What is the value of `myParam` in the context when the bad URL is sent? – AdrianHHH Jan 29 '19 at 21:56
  • The extraction happens before the context parameter is used. It always succeeds because it's Required=True and the webtest will automatically fail if the extraction isn't successful. – DRosser9 Jan 30 '19 at 12:01
  • (4) Please show the value of myParam from the context when the bad URL is sent, as per (4) in my previous comment. (5) You omitted the name of the extraction rule from the original version of your question. The extract regular expression rule is buggy in some Visual Studio versions. See [webtest-vs2013-extract-regular-expression-requiredfalse](https://social.msdn.microsoft.com/Forums/sqlserver/en-US/bae6af3b-45e7-48da-b4da-7b2733d35fba/webtest-vs2013-extract-regular-expression-requiredfalse?forum=vstest) – AdrianHHH Jan 30 '19 at 21:07
  • By default a load test only saves the web-test-result files for failing tests, and only the first 200 failures. The "**Run settings**" have properties that allow some, or all, of the results of successful test to be saved. Also the 200 can be altered. See https://learn.microsoft.com/en-us/previous-versions/ff400225%28v%3dvs.140%29 for details. – AdrianHHH Jan 30 '19 at 21:07
  • Has your question been answered? If not then please [edit] it to make it clearer. If it has been answered then please write an answer describing how you solved the problem. – AdrianHHH Feb 18 '19 at 09:45

0 Answers0