Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add App UI testing project

未关闭
#62 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
csharp

调研方向

首先比较现有的 Tests.App 项目与提议的 Tests.App.UI 项目,然后复现 issue 中描述的 DependencyObjectSelectorTest.cs 设置。先阅读 WinUI 3 模板设置以及 Microsoft.NET.Test.Sdk 和 UITestMethodAttribute 错误。当一个独立的 UI 测试项目能够在窗口的 DispatchQueue 内的 UI 线程上启动测试,且不再出现所报告的 entry-point 或 XAML 加载失败时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

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
  2. create AppTest project from winui3 unit testing template
  3. add DependencyObjectSelector.cs to App (which doesn't depend on anything so it's just a simple copy/paste and change namespace)
  4. add DependencyObjectSelectorTest.cs to AppTest, and accept the suggestion to add a project reference to App
  5. 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
  6. Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point.
  7. add <StartupObject>AppTest.Program</StartupObject> (which is the XAML generated main from winui 3)
  8. 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.

主要语言
C#
星标
29
派生
12
平均合并
4 小时 15 分钟
30 天内合并 PR
2

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

coder/coder-desktop-windows 的其他 Issue

查看 coder/coder-desktop-windows 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。