Stopping a webtest on a request error
Here is an article for how to stop a web test when an error occurs:
https://blogs.msdn.com/slumley/pages/adding-an-ie7-browser-template-for-use-by-web-tests.aspx
Comments
- Anonymous
September 21, 2006
Is there a way to set the Request Plug-in in the API? I have some classes that extend the WebTest class, which I would like to have use this request plug but I don't see an option to add it.
Thanks
Alan - Anonymous
September 22, 2006
There are ways to add this from the api. You actually have 2 options when you go to code. You can add this so that every request will use this plugin or you can add it to specific requests. To add it so that each request will use it, it would look like the following:
...
public class WebTest1Coded : WebTest
{
private StopTestPlugin requestPlugin = new StopTestPlugin();
public WebTest1Coded()
{
this.PreAuthenticate = true;
this.PreRequest += new EventHandler<PreRequestEventArgs>(this.requestPlugin.PreRequest);
this.PostRequest += new EventHandler<PostRequestEventArgs>(this.requestPlugin.PostRequest);
}
...
You can see that an instance of the plugin is created and added to the Pre and Post Request events for the web test class.
You can also wire it to just one request by doing something like:
...
StopTestPlugin stopPlugin = new StopTestPlugin();
WebTestRequest request1 = new WebTestRequest("http://...");
request1.ThinkTime = 1;
request1.PostRequest += new EventHandler<PostRequestEventArgs>(stopPlugin.PostRequest);
yield return request1;
...
In this case, you create an instance of the plugin and wire it to just one request. - Anonymous
September 22, 2006
One other thing I should mention about doing it from code, is that you are able to add multiple plugins. From the editor, you can only set one Request or test plugin, but from code you add as many as you like. - Anonymous
November 23, 2006
Hi and welcome back to Quality Tools blog! After a long hiatus, we are back to talk to you again about