Skip to content

Exception in AllureDisplayIgnoredAttribute if a test with cases marked with [Ignore] #518

@gamerka

Description

@gamerka

I'm submitting a ...

  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

If test class have test method with test cases with Ignore attribute.

If the current behavior is a bug, please provide the steps to reproduce and, if possible, a minimal demo of the problem

Add test with cases to a test class with AllureDisplayIgnored attribute and mark the whole test method with Ignore attribute.
Run this test from IDE or with dotnet test - no results file for this test in allure-results directory.
Run debug of test from IDE, set breakpoint inside AllureDisplayIgnoredAttribute class in EmitResultForIgnoredTestInTestPlan method executing by steps you will catch an exception in AllureNUnitHelper.CreateTestResult(test).
Sample project: https://github.com/gamerka/allure-nunit-ignore-bug

What is the expected behavior?

Result files for this test appear in allure-results directory.

What is the motivation / use case for changing the behavior?

Currently I have not found any workaround, my ignored tests are just missing from reports.

Please tell us about your environment:

Other information

Exception:

System.InvalidCastException: 'Unable to cast object of type 'NUnit.Framework.Internal.ParameterizedMethodSuite' to type 'NUnit.Framework.Internal.TestFixture'.'
This exception was originally thrown at this call stack:
    Allure.NUnit.Core.AllureNUnitHelper.GetTestFixture(NUnit.Framework.Interfaces.ITest) in AllureNUnitHelper.cs
    Allure.NUnit.Core.AllureNUnitHelper.IterateAllAllureAttribites(NUnit.Framework.Interfaces.ITest) in AllureNUnitHelper.cs
    Allure.NUnit.Core.AllureNUnitHelper.UpdateTestDataFromAllureAttributes(NUnit.Framework.Interfaces.ITest, Allure.Net.Commons.TestResult) in AllureNUnitHelper.cs
    Allure.NUnit.Core.AllureNUnitHelper.CreateTestResult(NUnit.Framework.Interfaces.ITest) in AllureNUnitHelper.cs
    Allure.NUnit.Attributes.AllureDisplayIgnoredAttribute.EmitResultForIgnoredTestInTestPlan(NUnit.Framework.Interfaces.ITest) in AllureDisplayIgnoredAttribute.cs
    Allure.NUnit.Attributes.AllureDisplayIgnoredAttribute.AfterTest(NUnit.Framework.Interfaces.ITest) in AllureDisplayIgnoredAttribute.cs
    NUnit.Framework.Internal.Commands.TestActionItem.AfterTest(NUnit.Framework.Interfaces.ITest) in TestActionItem.cs
    NUnit.Framework.Internal.Commands.AfterTestActionCommand..ctor.AnonymousMethod__0(NUnit.Framework.Internal.TestExecutionContext) in AfterTestActionCommand.cs
    NUnit.Framework.Internal.Commands.AfterTestCommand.Execute(NUnit.Framework.Internal.TestExecutionContext) in AfterTestCommand.cs
    NUnit.Framework.Internal.Commands.AfterTestCommand.Execute.AnonymousMethod__0() in AfterTestCommand.cs
    ...
    [Call Stack Truncated]

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions