I need to retrieve the status (Passed\ Failed\ No run) of each shared steps. I am able to access the shared step title and expected result, and I need to retrieve the outcome and the comment. I understand that these details can be retrieved from the ITestIterationResult(s) for that test execution, but could someone guide me with the code. Please help me out on this, given below is what i have so far.
public ISharedStep tstSharedStep { get; private set; }
public ISharedStepReference tstSharedStepRef { get; private set; }
foreach (ITestAction tstAction in tstCase.Actions)
{
tstSharedStep = null;
tstSharedStepRef = tstAction as ISharedStepReference;
if (tstSharedStepRef != null)
{
tstSharedStep = tstSharedStepRef.FindSharedStep();
foreach (ITestAction tstSharedAction in tstSharedStep.Actions)
{
ITestStep tstSharedTestStep = tstSharedAction as ITestStep;
resultData.Step = Regex.Replace(tstSharedTestStep.Title, @"<[^>]+>| ", "").Trim();
resultData.ExpectedResult = Regex.Replace(tstSharedTestStep.ExpectedResult, @"<[^>]+>| ", "").Trim();
}
}
else {
// regular step action
}
}
I was able to find a solution to this, and thought i'd share it..