Giter VIP home page Giter VIP logo

Comments (18)

AArnott avatar AArnott commented on July 4, 2024

Thanks for the write-up. [UIFact] is a framework-agnostic attribute that just emulates common things like a generic SyncContext to keep test execution on a single thread.
It sounds like WinUI has its own specialized SyncContext, which is similar to WinForms and WPF and why they eachhave their own attributes. Cocoa has its own fact too. If you can help us understand the specific requirements for emulating a WinUI main thread, adding support for that sounds good.

As for the issues you ran into, that sounds like it might have just been an issue with how you patched and used the modified DLL.

I'm happy to take a look as well. Where did you get the DispatcherQueueSynchronizationContext type? I don't see it available.

from xunit.stafact.

ScottAtBarco avatar ScottAtBarco commented on July 4, 2024

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

The Microsoft.WindowAppSDK package doesn't appear on nuget.org. I can't help make this work without the sync context type that you're talking about.

from xunit.stafact.

ScottAtBarco avatar ScottAtBarco commented on July 4, 2024

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

No. I don't know how ***@***.*** would help.

from xunit.stafact.

ScottAtBarco avatar ScottAtBarco commented on July 4, 2024

from xunit.stafact.

ScottAtBarco avatar ScottAtBarco commented on July 4, 2024

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

Thanks. Ya your image attachments are not coming from your email to the github issue comment. But your link worked. Apparently the nuget package ID is slightly different than you originally quoted (a typo, no doubt). I should be able to look into this now. Probably sometime next week.

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

So I gave this a shot. You can review it here.

This isn't as simple as it sounded. To create a DispatcherQueueSynchronizationContext, I need a DispatcherQueue as well, but these things aren't directly creatable it seems. How does one get one of these?

It sounds like you actually had a compilable thing that you expected to work, though it didn't. I'm finding it quite difficult to get something remotely close to working. So anything you can share from your original prototype would help expedite this.

from xunit.stafact.

ScottAtBarco avatar ScottAtBarco commented on July 4, 2024

from xunit.stafact.

ScottAtBarco avatar ScottAtBarco commented on July 4, 2024

from xunit.stafact.

ScottAtBarco avatar ScottAtBarco commented on July 4, 2024

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

Thanks for the blog link. I guess I have to create a Window object to get its DispatcherQueue property from it. I'm trying with that now.

the exception text in WaitForOperationCompletionAsync says WPF not WinUI.

Thanks. Fixed.

The exception itself is concerning. I will need to test async methods that must be run on the UI thread. The message says no “async void”. Does that mean “async Task” are ok? You have such tests in WpfFactTests.cs, so I’m guessing they are, but staring at the code in the diff tells me nothing.

Yes, async Task test methods are fine. It's the async void tests that don't work.

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

I've made a lot of progress. But the blog post is 2+ years old, and I had to make some changes to get WinUI tests building the way it proposed. But they don't run even with UITestMethod attributes. And the blog outlines some tight-knit interactions between the test runner and test framework, and assume that the test runner will execute the .exe instead of loading the test assembly as a library into another process. I don't know if xunit can do this. This could require xunit changes as well.

Latest changes

from xunit.stafact.

ScottAtBarco avatar ScottAtBarco commented on July 4, 2024

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

Yes, I understand the concession may include running an .exe. But unless you know of a way to get xunit tests to execute within an .exe test project that launches itself instead of by way of the xunit or dotnet test test runners, I don't see how we can make this work with xunit.

from xunit.stafact.

ScottAtBarco avatar ScottAtBarco commented on July 4, 2024

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

I don't know how you would make this work at this point. And xunit.stafact as an xunit library that your test project loads isn't properly positioned to spin up xunit.

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.