Working with Frames
We have a website that requires a login and, based on users roles, displays anywhere from 3 to 10 frames. The initial recording was done with a "super user" account so that all requests were recorded. Now, during playback with an ID having limited access, the web test fails due to the number of frames not authorized for this user.
I believe that I can determine what frames are authorized for this user by looking at the response from an earlier request and use this information to prevent the calls that I know are going to fail. Is this doable?
Thanks.
Yes this is doable. You have a few options.
1) Create a coded test. In the coded test, you can check the value of previoud response and use if statements to determine if a request should be executed.
2) If you do not want to use a coded test, you will still need to use some custom code. First you will need to add an extraction rule to a request which pulls out the value that you will use to determine if a request should be executed. Next you will need to create a WebTestRequestPlugin. This plugin is executed for each request. In the PreRequest handler, you can check the web test context for the extracted value and use this to determine if a reuest should be executed. If you do not want to execute the request, you can set the Instruction property on the PreRequestEventArgs to skip:
e.Instruction =
WebTestExecutionInstruction.Skip; This will force this request to not be executed.
ok... so I tried option two and it worked... however, the test run detail is giving a weird results. At the end of the test run, it shows the requests that were completed and then it shows two requests that were never requested. One of these is correct. The other one is not. It seems as if once I use the ".skip" it shows the request it skips as not requested in the display and then an other request after it. Anyone know why?