Mark Test as Error from End Activity Event Code
Posted: Thu Feb 06, 2020 2:16 pm
Hi everybody!
The developer made a label appear if an unknow error gets caught.
I need to check for this label best after every action and then copy the log of the Windows Application and other stuff.
So I decided to go with the Event Handler for End Activity. Works well except the fact, that I can't mark the test case properly as failure.
Error occurs at PLY_Observertest Recording.
Thanks for your help!
The developer made a label appear if an unknow error gets caught.
I need to check for this label best after every action and then copy the log of the Windows Application and other stuff.
So I decided to go with the Event Handler for End Activity. Works well except the fact, that I can't mark the test case properly as failure.
Code: Select all
ActivityStack.Instance.EndActivity += new EventHandler(ActivityStack_Instance_EndActivity);
...
static void ActivityStack_Instance_EndActivity(object sender, EventArgs e)
{
...
if (error_condition)
{
Report.Failure("ERROR", "Severe Error active"); // prints but does not mark test/testrun as failed
Validate.Fail("SevereError"); // causes the red X behind the test, but does not mark the test/testrun as failed
}
}
Thanks for your help!