coder / coder/coder-desktop-windows

Add App UI testing project

オープン
#62 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
C#
スター
26
フォーク
12
平均マージ
6時間 50分
マージ済み PR(30日)
1

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず既存の Tests.App プロジェクトと提案されている Tests.App.UI プロジェクトを比較し、次に issue に記載されている DependencyObjectSelectorTest.cs のセットアップを再現します。最初に WinUI 3 テンプレートのセットアップと、Microsoft.NET.Test.Sdk および UITestMethodAttribute のエラーを確認してください。別の UI テストプロジェクトで、報告されている entry-point または XAML 読み込みの失敗なしに、ウィンドウの DispatchQueue 内で UI スレッド上のテストを起動できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp
領域
desktop, testing-qa
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。