Skip to content

Skip attribute on [InlineData] is not respected in Visual Studio #266

@martincostello

Description

@martincostello

If the Skip property of an [InlineData] attribute (or derived types of DataAttribute) is populated with a message that it should be skipped, either statically in code or at runtime, Visual Studio does not respect that value and runs the test when the Visual Studio Test Explorer is used.

A repo containing a solution that demonstrates this issue can be found here: https://github.com/martincostello/broken-inlinedata-skip-repro

This appears to be a regression since xunit 2.3.1.

Running dotnet test using the CLI is not affected:

PS C:\Coding\broken-inlinedata-skip-repro> dotnet test
Build started, please wait...
Build completed.

Test run for C:\Coding\broken-inlinedata-skip-repro\bin\Debug\netcoreapp2.1\broken-inlinedata-skip-repro.dll(.NETCoreApp,Version=v2.1)
Microsoft (R) Test Execution Command Line Tool Version 15.7.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
[xUnit.net 00:00:00.98]     BrokenInlineDataSkip.Tests.Can_Add_Integers(x: 2, y: 2, expected: 4) [SKIP]
Skipped  BrokenInlineDataSkip.Tests.Can_Add_Integers(x: 2, y: 2, expected: 4)

Total tests: 2. Passed: 1. Failed: 0. Skipped: 1.
Test Run Successful.
Test execution time: 2.2485 Seconds

xunit 2.3.1 Behaviour

xunit 2.4.0 Behaviour

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions