In a ResultListener the OnTeststepRunStart method (and other) has a TestStepRun parameter. I was hoping it would contain properties like ‘IsChild’, ‘HasChilds’ etc. I want my ResultListener to act differently if test step is a ‘top-level’ step vs. is a child step.
How can this be done?
2 Likes
There isn’t a direct way, but you could check the ID or the Hash and compare it the the PlanRun (From OnTestPlanRunStart):
public Guid TestPlanId;
public override void OnTestPlanRunStart(TestPlanRun planRun)
{
Log.Info("Test plan \"{0}\" started", planRun.TestPlanName);
TestPlanId = planRun.Id;
}
public override void OnTestStepRunStart(TestStepRun stepRun)
{
Log.Info("Test step \"{0}\" started", stepRun.TestStepName);
if(stepRun.Parent == TestPlanId)
{
//"Top Level"
}
else
{
//Child Step
}
}
2 Likes
Good idea! I have tested this and it seems tol do the job.
2 Likes