Skip to content

Get rid of allure-xunit's [AllureXunit] and [AllureXunitTheory] attributes #344

@delatrie

Description

@delatrie

Currently, in order to use allure-xunit one have to:

  1. Install the package
  2. Create allureConfig.json
  3. Replace all [Fact] and [Theory] attributes with [AllureXunit] and [AllureXunitTheory].

The goal of this issue is to get rid of the 3rd step.

Motivation

The end goal is to make allure-xunit usable out-of-box. A user should be able to generate the report by just installing the package (optionally, adding some configuration) and running the tests.

Negative implications of using [AllureXunit] and [AllureXunitTheory]

The need to replace attributes has two major negative implications:

  1. It's a time-consuming operation if a user has a fairly large number of tests.
  2. The [AllureXunit] and [AllureXunitTheory] attributes cannot be composed with other attributes derived from [Fact] or [Theory]. If a user decides to utilize such attributes from a 3rd party library, there will be no way to use allure-xunit at all.

Example

  1. Current usage:

    using Allure.Xunit.Attributes;
    using Xunit;
    
    public class TestClass
    {
        [AllureXunit]
        public void TestMethod() { }
    
        [AllureXunitTheory]
        [InlineData(1, "a")]
        [InlineData(2, "b")]
        public void ParameterizedTestMethod(int a, string b) { }
    }
  2. Future usage:

    using Xunit;
    
    public class TestClass
    {
        [Fact]
        public void TestMethod(){}
    
        [Theory]
        [InlineData(1, "a")]
        [InlineData(2, "b")]
        public void ParameterizedTestMethod(int a, string b) { }
    }

The same report should be created for both usages:

Backward compatibility

Allure-xunit must still recognize the [AllureXunit] and [AllureXunitTheory] attributes correctly and collect test results from the corresponding test methods.

Metadata

Metadata

Labels

task:improvementChange that improves some user experience but can't be considered a new featuretheme:xunit

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions