Kevin Jones
Kevin Jones

Reputation: 2367

Unit Testing Windows 8 WIndows Runtime Component With TeamCity

I'm not a Windows 8 developer so excuse any stupid questions.

I have a Windows 8.1 application built in Visual Studio 2013 via a .sln file. This contains a number of projects: there is an application that relies on a library, this library (call it datalib) is built as a Windows Runtime Component (not a DLL); there is also a test project which runs tests on 'datalib'

All of this works fine in VS2013, i.e. the tests execute.

I've been tasked with creating a TeamCity build for this so I've create a TeamCity build that builds against the sln file but I can't get the tests to execute (they're MSTest tests).

In my configuration I've added the test.dll (in the 'include assembly files list') but when I add this on it's own then I get a bunch of errors around references to types in the 'datalib'

The 'datalib' is built into datalib.winmd (I'm assuming this is the binary) so I thought that including this in the assembly list would fix my problem, but it doesn't.

I assume I'm missing something simple, what is it?

Upvotes: 0

Views: 276

Answers (1)

Kevin Jones
Kevin Jones

Reputation: 2367

I'm now able to do this and it was a multi step process.

Firstly you don't load/test the winmd file directly you have to load the appx that's created by the test project 1; you can't use the MSTest runner that comes with TeamCity, instead you have to install the Visual Studio Test Runner plugin [2]; you have to run the build agent in an interactive process; and finally you have to install the root certificate that the application was signed with.

You reference the appx like you would a DLL AppX referenced in the build step

To install the build agent and have it run interactively it wasn't good enough to use the service and mark 'Interact with Desktop' you need to have full interaction so the agent has to be run from the desktop, as admin, at startup. To do this I had to create a scheduled task that run at startup and was given full privileges.

I installed the cert by running the ps1 file in the same directory as the appx file (Add-AppDevPackage.ps1) I'm sure this is overkill but it seemed like the easiest option at the time

[1] http://msdn.microsoft.com/en-us/library/hh691189.aspx

[2] https://confluence.jetbrains.com/display/TW/VSTest.Console+Runner

Upvotes: 1

Related Questions