Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Allure.NUnit.Examples/AllureStepTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ public static void StepWithParams(object firstParam, object lastParam)
Console.WriteLine(firstParam);
Console.WriteLine(lastParam);
}

[AllureStep("This step should fail")]
public static int FailedStep()
{
var x = 1;
return 1 / (1 - x);
}
}

[AllureSuite("Tests - Steps")]
Expand Down Expand Up @@ -70,5 +77,12 @@ public void SimpleStepTest2()
StepsExamples.StepWithParams(1, 2);
StepsExamples.StepWithParams(new[] { 1, 3, 5}, "array");
}

[Test]
[AllureName("Should fail on step")]
public void TestWithFailedStep()
{
Assert.That(()=> StepsExamples.FailedStep(), Throws.TypeOf<DivideByZeroException>());
}
}
}
11 changes: 9 additions & 2 deletions Allure.NUnit/Core/Steps/AllureStepAspect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,15 @@ public object Around(
}
else
{
return SyncHandler.MakeGenericMethod(returnType)
.Invoke(this, new object[] { target, args, metadata, stepName, stepParameters });
try
{
return SyncHandler.MakeGenericMethod(returnType)
.Invoke(this, new object[] { target, args, metadata, stepName, stepParameters });
}
catch (TargetInvocationException e)
{
throw e.InnerException ?? e;
}
}
}

Expand Down