Giter VIP home page Giter VIP logo

Comments (7)

AArnott avatar AArnott commented on July 4, 2024 1

Thanks. I look forward to your repro.

One difference in scenario to your snippet: the test runs I was debugging in WinForms were on the same class.

That's not how CollectionAttribute works, at least not base don my reading of the docs.
Per my reading, tests within a class never run in parallel anyway (given default behavior anyway). The CollectionAttribute allows you to extend that non-concurrency across multiple classes, as in my example.

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

Interesting. I didn't think that that attribute was the responsibility of this Library. I thought Xunit itself would take care of it. I'll look into it.

from xunit.stafact.

weltkante avatar weltkante commented on July 4, 2024

It might have been broken by one of the overrides WinFormsFact/Theory provide

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

I did some quick research in how CollectionAttribute works and don't see any correlation to the test discovery system.

So I wrote a quick test:

[Collection("A")]
public class ConcurrentClass1Tests
{
    [WinFormsFact]
    public void ConcurrentA()
    {
        Thread.Sleep(10000);
    }
}

[Collection("A")]
public class ConcurrentClass2Tests
{
    [WinFormsFact]
    public void ConcurrentB()
    {
        Thread.Sleep(10000);
    }
}

Without the Collection attribute on the test classes, Test Explorer in VS configured to run tests in parallel will run these two tests in parallel. But with the Collection attribute, only one test runs at a time. So I can't repro the problem you're describing.

from xunit.stafact.

weltkante avatar weltkante commented on July 4, 2024

Thanks, I'll have another look and see if I can build a repro. One difference in scenario to your snippet: the test runs I was debugging in WinForms were on the same class.

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

FWIW I just tried moving the two methods into one class and removing the Collection attribute. The VS Test Explorer still ran them one at a time, which is consistent with the xunit doc I link to.

from xunit.stafact.

weltkante avatar weltkante commented on July 4, 2024

That's not how CollectionAttribute works, at least not base don my reading of the docs.
Per my reading, tests within a class never run in parallel anyway (given default behavior anyway).

Thanks for looking into it and clearing up how its supposed to work, looks what I was seeing was a red herring.

I was running tests from VS ("Debug test" command on a single test class) and when I did break into the debugger due to failed tests I was seeing all other methods having a thread as well. I could reproduce that but the test tasks already are on RanToCompletion so I assume you report success back to Xunit before you terminate the threads.

Since the test failures looked like they were comming from running tests in parallel I probably was jumping to the wrong conclusions, sorry. Can't reproduce the test failures anymore so I'm not sure what was causing them, but apparently not what I thought it was.

from xunit.stafact.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.