Noksa / Allure.NUnit

C# NUnit Allure with improvements and SpecFlow3 adapter
MIT License
18 stars 6 forks source link

Since 3.1.1-beta1 throw new exception in code in method with AllureStep stops discovering steps at all #47

Open Noksa opened 4 years ago

Noksa commented 4 years ago

To Reproduce Code like this broke all AllureStep

[AllureStep("test")]
public void Test()
{
    Console.WriteLine("test");
    throw new Exception("test");
    Console.WriteLine("test");
}

Expected behavior

Screenshots

Versions

Noksa commented 4 years ago

So.

BAD:

[AllureStep("test")]
public void Test()
{
    Console.WriteLine("test");
    throw new Exception("test");
    Console.WriteLine("test");
}
[AllureStep("test")]
public void Test()
{
    Console.WriteLine("test");
    var throw = true;
    if (throw) throw new Exception("test");
}

GOOD:

[AllureStep("test")]
public void Test(bool throw)
{
    Console.WriteLine("test");
    if (throw) throw new Exception("test");
    Console.WriteLine("test");
}
[AllureStep("test")]
public string Test(bool throw)
{
    Console.WriteLine("test");
    if (throw) throw new Exception("test");
    return "test";
}

There is no need to fix this at the moment. Just don't throw an exception for nothing.