I need to stop a web test from running if an extraction rule fails.
The Extract method of the extraction rule class looks like this:
public override void Extract(object sender, ExtractionEventArgs e)
{
try
{
// fancy logic going on here
}
catch (ExtractionException ex)
{
e.Message = ex.Message;
e.Success = false;
}
}
The solution I was thinking about is to define a StopTestRequestPlugin class derived from WebTestRequestPlugin and in the body of the PostRequest method to check if any of the extraction rules failed and stop the test. This way, I can assign this class to any test, without changing the code for the test or for the extraction rules involved.
Is there a way to access the ExtractionRule objects which had the Extract methods set as event handlers for the request?
I'm using Visual Studio 2005 and .NET 2.0.
Thanks.