Allure.NUnit icon indicating copy to clipboard operation
Allure.NUnit copied to clipboard

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

Open Noksa opened this issue 5 years ago • 1 comments

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

  • NUnit: ...
  • Allure: 3.1.1-beta1

Noksa avatar May 20 '20 11:05 Noksa

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.

Noksa avatar May 20 '20 12:05 Noksa