diff --git a/Allure.NUnit/Core/AllureNUnitHelper.cs b/Allure.NUnit/Core/AllureNUnitHelper.cs index 932b1bdd..1101ec65 100644 --- a/Allure.NUnit/Core/AllureNUnitHelper.cs +++ b/Allure.NUnit/Core/AllureNUnitHelper.cs @@ -171,15 +171,9 @@ static void SetIdentifiers(ITest test, TestResult testResult) if (AllureLifecycle.AllureConfiguration.UseLegacyIds) { SetLegacyIdentifiers(test, testResult); + return; } - else - { - SetNewIdentifiers(test, testResult); - } - } - static void SetNewIdentifiers(ITest test, TestResult testResult) - { testResult.uuid = IdFunctions.CreateUUID(); testResult.fullName = IdFunctions.CreateFullName( test.Method.MethodInfo diff --git a/Allure.Net.Commons.Tests/FunctionTests/IdTests.cs b/Allure.Net.Commons.Tests/FunctionTests/IdTests.cs index 4aae70d3..0f1998bb 100644 --- a/Allure.Net.Commons.Tests/FunctionTests/IdTests.cs +++ b/Allure.Net.Commons.Tests/FunctionTests/IdTests.cs @@ -52,63 +52,64 @@ internal void GenericMethodOfGenericClass(List _, List __) { } [TestCase( nameof(MyClass.ParameterlessMethod), - "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests." + - "IdTests+MyClass.ParameterlessMethod()", + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass.ParameterlessMethod()", TestName = "ParameterlessMethod" )] [TestCase( nameof(MyClass.MethodWithParameterOfBuiltInType), - "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests." + - "IdTests+MyClass.MethodWithParameterOfBuiltInType(System.Int32)", + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass" + + ".MethodWithParameterOfBuiltInType(System.Int32)", TestName = "MethodWithParameterOfBuiltInType" )] [TestCase( nameof(MyClass.MethodWithParameterOfUserType), - "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests." + - "IdTests+MyClass.MethodWithParameterOfUserType(Allure.Net." + - "Commons.Tests:Allure.Net.Commons.Tests.FunctionTests." + - "IdTests+MyClass)", + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass" + + ".MethodWithParameterOfUserType(" + + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass" + + ")", TestName = "MethodWithParameterOfUserType" )] [TestCase( nameof(MyClass.MethodWithTwoParameters), - "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests." + - "IdTests+MyClass.MethodWithTwoParameters(System.Int32,Allure." + - "Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests." + - "IdTests+MyClass)", + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass" + + ".MethodWithTwoParameters(" + + "System.Int32," + + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass" + + ")", TestName = "MethodWithTwoParameters" )] [TestCase( nameof(MyClass.MethodWithRefParameter), - "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests." + - "IdTests+MyClass.MethodWithRefParameter(System.Int32&)", + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass" + + ".MethodWithRefParameter(System.Int32&)", TestName = "MethodWithRefParameter" )] [TestCase( nameof(MyClass.MethodWithGenericParameter), - "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests." + - "IdTests+MyClass.MethodWithGenericParameter[T]()", + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass" + + ".MethodWithGenericParameter[T]()", TestName = "MethodWithGenericParameter" )] [TestCase( nameof(MyClass.MethodWithArgumentOfGenericType), - "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests." + - "IdTests+MyClass.MethodWithArgumentOfGenericType[T](T)", + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass" + + ".MethodWithArgumentOfGenericType[T](T)", TestName = "MethodWithArgumentOfGenericType" )] [TestCase( nameof(MyClass.MethodWithArgumentOfTypeParametrizedByGenericType), - "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests." + - "IdTests+MyClass.MethodWithArgumentOfTypeParametrizedByGenericType" + - "[T](System.Collections.Generic.Dictionary`2[System.Int32,T])", + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass" + + ".MethodWithArgumentOfTypeParametrizedByGenericType[T](" + + "System.Collections.Generic.Dictionary`2[System.Int32,T]" + + ")", TestName = "MethodWithArgumentOfTypeParametrizedByGenericType" )] [TestCase( nameof(MyClass.MethodWithArgumentOfGenericUserType), - "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests." + - "IdTests+MyClass.MethodWithArgumentOfGenericUserType" + - "[T](Allure.Net.Commons.Tests:Allure.Net.Commons.Tests." + - "FunctionTests.IdTests+MyClass`1[T])", + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass" + + ".MethodWithArgumentOfGenericUserType[T](" + + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass`1[T]" + + ")", TestName = "MethodWithArgumentOfGenericUserType" )] public void FullNameFromMethod(string methodName, string expectedFullName) @@ -134,10 +135,11 @@ public void TestFullNameFromMethodOfNestedGenericClass() var actualFullName = IdFunctions.CreateFullName(method); Assert.That(actualFullName, Is.EqualTo( - "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests." + - "IdTests+MyClass`1[T].GenericMethodOfGenericClass[V]" + - "(System.Collections.Generic.List`1[T],System.Collections." + - "Generic.List`1[V])" + "Allure.Net.Commons.Tests:Allure.Net.Commons.Tests.FunctionTests.IdTests+MyClass`1[T]" + + ".GenericMethodOfGenericClass[V](" + + "System.Collections.Generic.List`1[T]," + + "System.Collections.Generic.List`1[V]" + + ")" )); } diff --git a/Allure.Net.Commons/Steps/AllureStepAspect.cs b/Allure.Net.Commons/Steps/AllureStepAspect.cs index 23685e46..9e7c14b4 100644 --- a/Allure.Net.Commons/Steps/AllureStepAspect.cs +++ b/Allure.Net.Commons/Steps/AllureStepAspect.cs @@ -81,7 +81,7 @@ private static void PassFixture(MethodBase metadata) if (metadata.GetCustomAttribute(inherit: true) != null || metadata.GetCustomAttribute(inherit: true) != null) { - CoreStepsHelper.PassFixture(result => result.status = Status.passed); + CoreStepsHelper.PassFixture(); } } diff --git a/Allure.SpecFlowPlugin/PluginHelper.cs b/Allure.SpecFlowPlugin/PluginHelper.cs index ae566900..790c8c5c 100644 --- a/Allure.SpecFlowPlugin/PluginHelper.cs +++ b/Allure.SpecFlowPlugin/PluginHelper.cs @@ -261,36 +261,9 @@ string parametersHash scenarioTitle, parametersHash ); + return; } - else - { - SetNewTestResultIdentifiers( - testRunnerManager, - featureInfo, - testResult, - scenarioTitle - ); - } - } - - static void SetLegacyTestResultIdentifiers( - TestResult testResult, - string scenarioTitle, - string parametersHash - ) - { - testResult.uuid = NewId(); - testResult.historyId = scenarioTitle + parametersHash; - testResult.fullName = scenarioTitle; - } - static void SetNewTestResultIdentifiers( - ITestRunnerManager testRunnerManager, - FeatureInfo featureInfo, - TestResult testResult, - string scenarioTitle - ) - { testResult.uuid = IdFunctions.CreateUUID(); testResult.fullName = CreateFullName( testRunnerManager, @@ -306,6 +279,17 @@ string scenarioTitle ); } + static void SetLegacyTestResultIdentifiers( + TestResult testResult, + string scenarioTitle, + string parametersHash + ) + { + testResult.uuid = NewId(); + testResult.historyId = scenarioTitle + parametersHash; + testResult.fullName = scenarioTitle; + } + static string CreateFullName( ITestRunnerManager testRunnerManager, FeatureInfo featureInfo, diff --git a/Allure.XUnit/AllureXunitHelper.cs b/Allure.XUnit/AllureXunitHelper.cs index de0f27ed..5b0fc52d 100644 --- a/Allure.XUnit/AllureXunitHelper.cs +++ b/Allure.XUnit/AllureXunitHelper.cs @@ -230,11 +230,17 @@ TestResult testResult if (AllureLifecycle.Instance.AllureConfiguration.UseLegacyIds) { SetLegacyTestResultIdentifiers(testCase, displayName, testResult); + return; } - else - { - SetNewTestResultIdentifiers(testCase, testResult); - } + + testResult.uuid = IdFunctions.CreateUUID(); + testResult.fullName = IdFunctions.CreateFullName( + testCase.TestMethod.Method.ToRuntimeMethod() + ); + testResult.testCaseId = IdFunctions.CreateTestCaseId( + testResult.fullName + ); + // historyId is set later, when test arguments are received } static void UpdateHistoryId(TestResult testResult) @@ -259,21 +265,6 @@ TestResult testResult testResult.historyId = displayName; } - static void SetNewTestResultIdentifiers( - ITestCase testCase, - TestResult testResult - ) - { - testResult.uuid = IdFunctions.CreateUUID(); - testResult.fullName = IdFunctions.CreateFullName( - testCase.TestMethod.Method.ToRuntimeMethod() - ); - testResult.testCaseId = IdFunctions.CreateTestCaseId( - testResult.fullName - ); - // historyId is set later, when test arguments are received - } - static void UpdateTestDataFromAttributes( TestResult testResult, ITestMethod method