[PR #4105] [MERGED] Fix unittesting our .xaml classes #25641

Open
opened 2026-01-31 09:10:49 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/4105
Author: @zadjii-msft
Created: 1/3/2020
Status: Merged
Merged: 1/10/2020
Merged by: @undefined

Base: masterHead: dev/migrie/f/now-this-is-unittesting


📝 Commits (10+)

  • 9c47d8b so this is a copypasta of the TAEF example on how to do this. We'll play more with it in the next commit. THIS REQUIRES x86 BUILDS
  • 9b11d73 I'm shocked by how well this works
  • 8bd917b cleanup for review
  • 007a1df Revert this file, it shouldn't be changed
  • 1dff577 Merge remote-tracking branch 'origin/master' into dev/migrie/f/now-this-is-unittesting
  • f19771c Update to the actually working TAEF package
  • 586cfb3 minor cleanup from PR
  • 18f6a29 Clean up the project to remove duplicated stuff from common.props
  • e65987b hey maybe it'll work in CI?
  • a5523af Oops didn't save this file

📊 Changes

25 files changed (+412 additions, -108 deletions)

View changed files

📝 OpenConsole.sln (+36 -3)
📝 src/cascadia/LocalTests_TerminalApp/ColorSchemeTests.cpp (+1 -1)
📝 src/cascadia/LocalTests_TerminalApp/KeyBindingsTests.cpp (+1 -1)
📝 src/cascadia/LocalTests_TerminalApp/ProfileTests.cpp (+1 -1)
📝 src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp (+1 -1)
📝 src/cascadia/LocalTests_TerminalApp/TabTests.cpp (+52 -7)
📝 src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj (+11 -81)
src/cascadia/LocalTests_TerminalApp/TestHostApp/Package.appxmanifest (+27 -0)
src/cascadia/LocalTests_TerminalApp/TestHostApp/TestHostApp.vcxproj (+162 -0)
src/cascadia/LocalTests_TerminalApp/TestHostApp/UnitTestApp.xaml (+8 -0)
src/cascadia/LocalTests_TerminalApp/TestHostApp/UnitTestApp.xaml.cpp (+27 -0)
src/cascadia/LocalTests_TerminalApp/TestHostApp/UnitTestApp.xaml.h (+27 -0)
src/cascadia/LocalTests_TerminalApp/TestHostApp/pch.cpp (+6 -0)
src/cascadia/LocalTests_TerminalApp/TestHostApp/pch.h (+8 -0)
📝 src/cascadia/LocalTests_TerminalApp/pch.h (+2 -0)
📝 src/cascadia/TerminalApp/CascadiaSettings.h (+2 -0)
📝 src/cascadia/TerminalApp/TerminalPage.h (+8 -0)
📝 src/common.build.tests.props (+2 -2)
📝 src/host/ft_uia/Host.Tests.UIA.csproj (+5 -5)
📝 src/host/ft_uia/packages.config (+1 -1)

...and 5 more files

📄 Description

Summary of the Pull Request

New year, new unittests.

This PR introduces a new project, TestHostApp. This project is largely taken from the TAEF samples, and allows us to easily construct a helper executable and resources.pri for running TerminalApp unittests.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

Unittesting for the TerminalApp project has been a horrifying process to try getting everything pieced together just right. Dependencies need to get added to manifests, binplaced correctly, and XAML resources need to get compiled together as well. In addition, using a MUX Application (as opposed to the Windows.UI.Xaml Application) has led to additional problems.

This was always a horrifying house of cards for us. Turns out, the reason this was so horrible is that the test infrastructure for doing what we're doing literally didn't exist when I started doing all that work last year.

So, with help from the TAEF team, I was able to get rid of our entire house of cards, and use a much simpler project to build and run the tests.

Unfortunately, the latest TAEF release has a minor bug in it's build rules, and only publishes the x86 version of a dll we need from them. But, the rest of this PR works for x86, and I'll bump this when that updated version is available. We should be able to review this even in the state it's in.

Validation Steps Performed

ran the tests yo


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/4105 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 1/3/2020 **Status:** ✅ Merged **Merged:** 1/10/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `dev/migrie/f/now-this-is-unittesting` --- ### 📝 Commits (10+) - [`9c47d8b`](https://github.com/microsoft/terminal/commit/9c47d8b7c811864744adc906b5009cc83a23f88d) so this is a copypasta of the TAEF example on how to do this. We'll play more with it in the next commit. THIS REQUIRES x86 BUILDS - [`9b11d73`](https://github.com/microsoft/terminal/commit/9b11d73a1c04315bacbf13ed4f05a82608d56166) I'm _shocked_ by how well this works - [`8bd917b`](https://github.com/microsoft/terminal/commit/8bd917b5ca048fa5883e5e7f8221b601e706f739) cleanup for review - [`007a1df`](https://github.com/microsoft/terminal/commit/007a1df0154b230aef0824e17104af8fa44563a0) Revert this file, it shouldn't be changed - [`1dff577`](https://github.com/microsoft/terminal/commit/1dff5770c7db217a0e81e9ee96de8dfce3574249) Merge remote-tracking branch 'origin/master' into dev/migrie/f/now-this-is-unittesting - [`f19771c`](https://github.com/microsoft/terminal/commit/f19771cebd1b98ed954cf5a30660a0139f0961ce) Update to the actually working TAEF package - [`586cfb3`](https://github.com/microsoft/terminal/commit/586cfb3e6f39a348de74d2019239bb1b49a1c3fe) minor cleanup from PR - [`18f6a29`](https://github.com/microsoft/terminal/commit/18f6a29eedcbf613289cea500be356aa717fc6cc) Clean up the project to remove duplicated stuff from common.props - [`e65987b`](https://github.com/microsoft/terminal/commit/e65987b6f2e8587cd8f0b413783e5f845b6ecde4) hey maybe it'll work in CI? - [`a5523af`](https://github.com/microsoft/terminal/commit/a5523af01221251e43ad2e29bd5a40d05cb78bec) Oops didn't save this file ### 📊 Changes **25 files changed** (+412 additions, -108 deletions) <details> <summary>View changed files</summary> 📝 `OpenConsole.sln` (+36 -3) 📝 `src/cascadia/LocalTests_TerminalApp/ColorSchemeTests.cpp` (+1 -1) 📝 `src/cascadia/LocalTests_TerminalApp/KeyBindingsTests.cpp` (+1 -1) 📝 `src/cascadia/LocalTests_TerminalApp/ProfileTests.cpp` (+1 -1) 📝 `src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp` (+1 -1) 📝 `src/cascadia/LocalTests_TerminalApp/TabTests.cpp` (+52 -7) 📝 `src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj` (+11 -81) ➕ `src/cascadia/LocalTests_TerminalApp/TestHostApp/Package.appxmanifest` (+27 -0) ➕ `src/cascadia/LocalTests_TerminalApp/TestHostApp/TestHostApp.vcxproj` (+162 -0) ➕ `src/cascadia/LocalTests_TerminalApp/TestHostApp/UnitTestApp.xaml` (+8 -0) ➕ `src/cascadia/LocalTests_TerminalApp/TestHostApp/UnitTestApp.xaml.cpp` (+27 -0) ➕ `src/cascadia/LocalTests_TerminalApp/TestHostApp/UnitTestApp.xaml.h` (+27 -0) ➕ `src/cascadia/LocalTests_TerminalApp/TestHostApp/pch.cpp` (+6 -0) ➕ `src/cascadia/LocalTests_TerminalApp/TestHostApp/pch.h` (+8 -0) 📝 `src/cascadia/LocalTests_TerminalApp/pch.h` (+2 -0) 📝 `src/cascadia/TerminalApp/CascadiaSettings.h` (+2 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+8 -0) 📝 `src/common.build.tests.props` (+2 -2) 📝 `src/host/ft_uia/Host.Tests.UIA.csproj` (+5 -5) 📝 `src/host/ft_uia/packages.config` (+1 -1) _...and 5 more files_ </details> ### 📄 Description ## Summary of the Pull Request New year, new unittests. This PR introduces a new project, `TestHostApp`. This project is largely taken from the TAEF samples, and allows us to easily construct a helper executable and `resources.pri` for running TerminalApp unittests. ## References ## PR Checklist * [x] Closes #3986 * [x] I work here * [x] is Tests * [n/a] Requires documentation to be updated * [x] **Waiting for an updated version of TAEF to be available** ## Detailed Description of the Pull Request / Additional comments Unittesting for the TerminalApp project has been a horrifying process to try getting everything pieced together just right. Dependencies need to get added to manifests, binplaced correctly, and XAML resources need to get compiled together as well. In addition, using a MUX `Application` (as opposed to the Windows.UI.Xaml `Application`) has led to additional problems. This was always a horrifying house of cards for us. Turns out, the reason this was so horrible is that the test infrastructure for doing what we're doing _literally didn't exist_ when I started doing all that work last year. So, with help from the TAEF team, I was able to get rid of our entire house of cards, and use a much simpler project to build and run the tests. Unfortunately, the latest TAEF release has a minor bug in it's build rules, and only publishes the x86 version of a dll we need from them. But, the rest of this PR works for x86, and I'll bump this when that updated version is available. We should be able to review this even in the state it's in. ## Validation Steps Performed ran the tests yo --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:10:49 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#25641