Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allure.Xunit improvements #461

Merged
merged 13 commits into from
Mar 28, 2024
Merged

Allure.Xunit improvements #461

merged 13 commits into from
Mar 28, 2024

Conversation

delatrie
Copy link
Contributor

@delatrie delatrie commented Mar 27, 2024

Namespace consolidation

Previously, Allure.XUnit mixed two namespaces: Allure.XUnit and Allure.Xunit. This PR consolidated the namespace to Allure.Xunit (as the xUnit.net itself uses Xunit). Users should adapt their code accordingly:

  • Allure.XUnit.Attachments -> Allure.Xunit.Attachments
  • Allure.XUnit.Attributes.Steps.AllureAfterAttribute -> Allure.Xunit.Attributes.Steps.AllureAfterAttribute
  • Allure.XUnit.Attributes.Steps.AllureBeforeAttribute -> Allure.Xunit.Attributes.Steps.AllureBeforeAttribute
  • Allure.XUnit.Attributes.Steps.AllureStepAttribute -> Allure.Xunit.Attributes.Steps.AllureStepAttribute
  • Allure.XUnit.Attributes.Steps.NameAttribute -> Allure.Xunit.Attributes.Steps.NameAttribute
  • Allure.XUnit.Attributes.Steps.SkipAttribute -> Allure.Xunit.Attributes.Steps.SkipAttribute

Note

All Allure.Xunit attributes not explicitly listed above were already in the correct namespace from the start.

The Allure.XUnit namespace is still in place. Accessing it will produce a deprecation warning.

API deprecations and removals

The following API was removed:

  • using-style steps/fixtures (use [AllureStep]/[AllureBefore]/[AllureAfter], AllureApi, or ExtendedApi instead):
    • Allure.Xunit.AllureBefore
    • Allure.Xunit.AllureAfter
    • Allure.Xunit.AllureStep
    • Allure.Xunit.AllureStepBase
  • Allure.Xunit.AllureAttachments (use AllureApi.AddAttachment instead).
  • Some currently unused methods of the internal AllureXunitHelper class that had been made public by accident:
    • StartTestContainer
    • StartTestCase
    • MarkTestCaseAsFailedOrBroken
    • MarkTestCaseAsPassed
    • MarkTestCaseAsSkipped
    • FinishTestCase
  • Allure.Xunit.Steps: use AllureApi/ExtendedApi instead.
  • Allure.Xunit.Attributes.AllureXunitAttribute and Allure.Xunit.Attributes.AllureXunitTheoryAttribute: use [Fact] and [Theory] instead.

The PR hides the following API that wasn't meant to be public in the first place:

  • AllureXunitFacade
  • AllureXunitHelper
  • AllureMessageSink

The second reporter resolution

If the xunitRunnerReporter option is set to auto (the default) or to a reporter's name, the reporter resolution process kicks in. It used to scan too many assemblies from the domain. While some filters have been in place, there needed to be more as errors like #412 occur occasionally.

The new resolution algorithm applies an extra filter: an assembly must have *reporters* in its name. It gradually reduces the number of assemblies to scan while is in line with how recent versions of xUnit.net try to find a reporter (see here).

Target framework change

Allure.Xunit now targets netstandard2.0 and netcoreapp3.1. The main driver to increase the netcoreapp version is [CVE-2021-26701](https://www.cvedetails.com/cve/CVE-2021-26701/).

Due to how xUnit.net manages its packages, that change means we support the following frameworks:

  • .NET Core 3.1
  • .NET 5.0 or greater

All other frameworks might be supported except the following (which are not):

  • Any version of the .NET Framework
  • .NET Core before version 3.1
  • Any other framework that, given the following possible TFMs of a dependency: net35;net452;netstandard1.1;netstandard1.5;netcoreapp1.0 resolves it to something other than netstandard1.5. That's the general rule. The two above cases are just special cases of it.

Other Changes

  • Allure.XUnit now uses the common skip message for tests excluded by a test plan.
  • False warnings were removed for [Theory(Skip = "...")] (fixes xUnit.net: False missing arguments warning if [Theory(Skip = "...")] is used #421)
  • Some obsolete examples were removed from Allure.XUnit.Examples
  • Allure.XUnit now uses the common algorithm to distinguish between failed and broken tests.
  • Fix some typos and wording in README of Allure.Xunit.

@delatrie delatrie self-assigned this Mar 27, 2024
@delatrie delatrie force-pushed the xunit-fixes-2403 branch 3 times, most recently from 6c80232 to cd79480 Compare March 27, 2024 23:30
@delatrie delatrie changed the title Allure.XUnit improvements Allure.Xunit improvements Mar 28, 2024
@delatrie delatrie force-pushed the commons-fixes-2403 branch from efc568a to 61705d9 Compare March 28, 2024 10:50
@delatrie delatrie force-pushed the commons-fixes-2403 branch from 61705d9 to 0a561ad Compare March 28, 2024 13:20
@delatrie delatrie changed the base branch from commons-fixes-2403 to main March 28, 2024 13:27
@delatrie delatrie marked this pull request as ready for review March 28, 2024 13:27
@delatrie delatrie requested a review from epszaw March 28, 2024 13:31
delatrie added 13 commits March 28, 2024 23:25
  - using-style steps/fixtures:
      - Allure.Xunit.AllureBefore
      - Allure.Xunit.AllureAfter
      - Allure.Xunit.AllureStep
      - Allure.Xunit.AllureStepBase
  - Async attachment functions in Allure.Xunit.AllureAttachments
  - Unused internal methods of AllureXunitHelper that had accidentally
    leaked into public API:
      - StartTestContainer
      - StartTestCase
      - MarkTestCaseAsFailedOrBroken
      - MarkTestCaseAsPassed
      - MarkTestCaseAsSkipped
      - FinishTestCase
  - The Allure.Xunit.Steps class
  - AllureXunitAttribute and AllureXunitTheoryAttribute
    (not used anymore)
Now, it only considers assemblies with names matching the
*reporters* pattern.
@delatrie delatrie merged commit bf869a2 into main Mar 28, 2024
3 checks passed
@delatrie delatrie deleted the xunit-fixes-2403 branch March 28, 2024 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment