Skip to content

If all tests are skipped, exit code is 0 not 8 #3216

Closed

Description

Unsure whether you guys would consider this a bug, but it doesn't make sense in my head to try to execute a test suite and then skip everything. That would imply to me something has gone wrong.

And if you really did want to do that, you could just pass in --ignore-exit-code 8

So I'd want an error exit code to be returned to make me aware of that.

Repro:

internal class DummyAdapter() : ITestFramework, IDataProducer
{
    public string Uid => nameof(DummyAdapter);

    public string Version => string.Empty;

    public string DisplayName => string.Empty;

    public string Description => string.Empty;

    public Type[] DataTypesProduced => new[] { typeof(TestNodeUpdateMessage) };

    public Task<CloseTestSessionResult> CloseTestSessionAsync(CloseTestSessionContext context) => Task.FromResult(new CloseTestSessionResult { IsSuccess = true });

    public Task<CreateTestSessionResult> CreateTestSessionAsync(CreateTestSessionContext context) => Task.FromResult(new CreateTestSessionResult { IsSuccess = true });

    public Task ExecuteRequestAsync(ExecuteRequestContext context)
    {
        context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage(new SessionUid("1"), new TestNode()
        {
            Uid = "2",
            DisplayName = "Blah",
            Properties = new PropertyBag(new SkippedTestNodeStateProperty())
        }));
     
        context.Complete();
        
        return Task.CompletedTask;
    }

    public Task<bool> IsEnabledAsync() => Task.FromResult(true);
}

internal class Capabilities : ITestFrameworkCapabilities
{
    IReadOnlyCollection<ITestFrameworkCapability> ICapabilities<ITestFrameworkCapability>.Capabilities
        => Array.Empty<ITestFrameworkCapability>();
}

Activity

  1. Evangelink commented on Jul 10, 2024

    @Evangelink
    Member

    Hi Tom Longhurst (@thomhurst)! Let me test that out but I am surprised as this is the exact scenario being raised in #3121 where we do fail with exit code 8.

  2. thomhurst commented on Jul 10, 2024

    @thomhurst
    ContributorAuthor

    Hi Tom Longhurst (@thomhurst)! Let me test that out but I am surprised as this is the exact scenario being raised in #3121 where we do fail with exit code 8.

    That's filtering and therefore discovering zero tests. This is discovering a test but setting the skipped state on the test node. So slightly different scenario

  3. Evangelink commented on Jul 10, 2024

    @Evangelink
    Member

    Ah wait no sorry! Test is being reported in your example but in the linked issue the tests are not reported as skipped.

  4. Evangelink commented on Jul 10, 2024

    @Evangelink
    Member

    Just had a quick chat with Marco Rossignoli (@MarcoRossignoli) and we do think it makes sense and that exit code 8 should be reported here. Adding as a bug to current iteration so that it gets fixed before we release.

  5. added
    area/mtp
    and removed
    needs/triage
    on Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/mtp

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions