Web Testing - How to fix Context parameter not fou

2019-09-20 06:52发布

问题:

I am trying to resolve the following error in my webtest:

Request failed: Context parameter '$HIDDEN1.hdnActiveInActive' not found in test context

I have looked at the various MSDN debugging blogs and several articles here as well but have not found a solution to the issue. I would appreciate it if anyone could help point me in the right direction to resolve this issue.

回答1:

Commonly this occurs because an earlier request did not work as expected. Thus the "extract hidden fields" rule did not find the field required by the request that is reported as failing. Just because the first two lines shown in the test log have green ticks does not mean the requests succeeded.

Look in the responses to the preceding requests. The request and the redirection have names suggesting they are a login. It may be that the login failed, but at the HTTP level the request succeeded because the web site returned a "login not successful" message.

After working out why the login failed (assuming that that is the problem) I recommend adding a validation rule to the login request. It should check that the response contains a phrase similar to "login successful", but obviously changed to use the actual text that the web site returns.