coder / coder/coder-desktop-windows

Add App UI testing project

Ouverte
#62 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
C#
Étoiles
26
Forks
12
Merge moyen
6 h 50 min
PR mergées (30 j)
1

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par comparer le projet existant Tests.App avec le projet proposé Tests.App.UI, puis reproduisez la configuration de DependencyObjectSelectorTest.cs décrite dans l’issue. Lisez d’abord la configuration du modèle WinUI 3 ainsi que les erreurs de Microsoft.NET.Test.Sdk et de UITestMethodAttribute. Le travail est terminé lorsqu’un projet de test UI séparé peut lancer des tests sur le thread UI à l’intérieur d’une DispatchQueue de fenêtre sans les erreurs d’entry-point ou de chargement XAML signalées.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp
Domaine
desktop, testing-qa
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.