<p>I have a Universal Windows Platform (UWP) application, but I am having trouble testing it.</p>

<p>First off, there seems to be some issue with running MSTest in the latest versions of Visual Studio (currently V.S. 2017, 15.5.3) where the test app pops up a window and doesn't close it, never finishes, and doesn't let me run it twice. I've googled and debugged for days with no fix in sight. I've changed runtime versions and target platforms. I've started fresh. I've tried some of my co-workers. We're all having this problem. So MSTest doesn't work with UWP applications. I've also played with <code>mstest.exe</code> via the command line for a few hours and couldn't get it to run, I suspect because of the immaturity of the UWP platform.</p>

<p>That doesn't really matter though, because even if it did, in order to execute my unit tests in a build, I would have to run them in a windowless environment on my build server. TFS can't execute it because it has to pop open a window and there is no GUI running on the company's TFS servers.</p>

<p>I switched to xUnit because of the MSTest issues. Just a bit of rewriting and we're back in business on the unit testing front. xUnit forces me to open the tests in an application window and run it from there because xUnit for Windows Universal doesn't integrate into Visual Studio. That also means I can't run it headlessly on my TFS build/integration server. Again, I'm in the same spot.</p>

<p>So what have I missed? Is there any way to automate my unit testing via TFS build server, or have we simply picked the wrong platform for the job?</p>

CC BY-SA 4.0
2018-12-27T01:20:38.253Z
Have you seen [Set up automated builds for your UWP app](https://docs.microsoft.com/en-us/windows/uwp/packaging/auto-build-package-uwp-apps#set-up-a-continuous-integration-ci-build).  Also checkout [DevOps for IoT with Win10 IoT Core, UWP, and VSTS](https://blogs.msdn.microsoft.com/devops/2018/03/07/devops-for-iot-with-win10-iot-core-uwp-and-vsts/)
Deleted
CC BY-SA 4.0
2019-01-08T20:06:24.830Z
Thanks, @MickyDuncan . Both of those were written well after I asked, and frankly, I've moved on to different projects, but I am leaving the question up here for posterity. I think you could form a pretty good answer with those links and score some points for yourself :)
Nathan Strutz
CC BY-SA 4.0
2019-01-09T00:55:18.157Z
Ah this is true good sir.  I’ve just started UWP so I’ve been Googling madly and came across your post :)
Deleted
<automation><dotnet><tfs>
How to automate unit testing a UWP app?
Nathan Strutz
# How to automate unit testing a UWP app?

(Asked by: username_0 on 2018-01-10)

I have a Universal Windows Platform (UWP) application, but I am having trouble testing it.

First off, there seems to be some issue with running MSTest in the latest versions of Visual Studio (currently V.S. 2017, 15.5.3) where the test app pops up a window and doesn't close it, never finishes, and doesn't let me run it twice. I've googled and debugged for days with no fix in sight. I've changed runtime versions and target platforms. I've started fresh. I've tried some of my co-workers. We're all having this problem. So MSTest doesn't work with UWP applications. I've also played with `mstest.exe` via the command line for a few hours and couldn't get it to run, I suspect because of the immaturity of the UWP platform.

That doesn't really matter though, because even if it did, in order to execute my unit tests in a build, I would have to run them in a windowless environment on my build server. TFS can't execute it because it has to pop open a window and there is no GUI running on the company's TFS servers.

I switched to xUnit because of the MSTest issues. Just a bit of rewriting and we're back in business on the unit testing front. xUnit forces me to open the tests in an application window and run it from there because xUnit for Windows Universal doesn't integrate into Visual Studio. That also means I can't run it headlessly on my TFS build/integration server. Again, I'm in the same spot.

So what have I missed? Is there any way to automate my unit testing via TFS build server, or have we simply picked the wrong platform for the job?

**Tags:** automation, dotnet, tfs

> **Comments:**
> **username_1**: Have you seen [Set up automated builds for your UWP app](https://docs.microsoft.com/en-us/windows/uwp/packaging/auto-build-package-uwp-apps#set-up-a-continuous-integration-ci-build).  Also checkout [DevOps for IoT with Win10 IoT Core, UWP, and VSTS](https://blogs.msdn.microsoft.com/devops/2018/03/07/devops-for-iot-with-win10-iot-core-uwp-and-vsts/)  
> **username_0**: Thanks, @MickyDuncan . Both of those were written well after I asked, and frankly, I've moved on to different projects, but I am leaving the question up here for posterity. I think you could form a pretty good answer with those links and score some points for yourself :)  
> **username_1**: Ah this is true good sir.  I’ve just started UWP so I’ve been Googling madly and came across your post :)  

---

## 0 answers

