coder / coder/coder-desktop-windows
Add App UI testing project
- Ngôn ngữ chính
- C#
- Star
- 26
- Fork
- 12
- Merge trung bình
- 6 giờ 50 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
We need a separate project for testing UI-related code from the App project. We currently have `Tests.App` but we probably should add `Tests.App.UI` as a separate project.
Test code needs to be launched on a UI thread inside of a window's DispatchQueue.
I've tried doing the following in a new solution to see how feasible it is to do, but have run into issue after issue:
1. create `App` project from winui3 template
1. create `AppTest` project from winui3 unit testing template
1. add `DependencyObjectSelector.cs` to `App` (which doesn't depend on anything so it's just a simple copy/paste and change namespace)
1. add `DependencyObjectSelectorTest.cs` to `AppTest`, and accept the suggestion to add a project reference to `App`
1. click the greyed out test run icon beside the test method, accept the prompt to install `Microsoft.NET.Test.Sdk`
click the green test run icon
1. `Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point.`
1. add `AppTest.Program` (which is the XAML generated main from winui 3)
1. `An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute 'Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer.UITestMethodAttribute'.`
I've also tried using the entry point from `Microsoft.NET.Test.Sdk` (which is empty) and doing winui 3 startup in an `AssemblyInitializer`, and it gets a bit further but I run into XAML loading issues.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu bằng cách so sánh project Tests.App hiện có với project Tests.App.UI được đề xuất, sau đó tái hiện thiết lập của DependencyObjectSelectorTest.cs được mô tả trong issue. Trước tiên, hãy đọc thiết lập của template WinUI 3 và các lỗi của Microsoft.NET.Test.Sdk và UITestMethodAttribute. Hoàn tất khi một project kiểm thử UI riêng biệt có thể chạy các kiểm thử trên UI thread bên trong DispatchQueue của một cửa sổ mà không gặp các lỗi entry-point hoặc lỗi tải XAML đã được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- csharp
- Lĩnh vực
- desktop, testing-qa
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100