Teamcity and Unit Testing Windows Store Apps
I was trying to build Teamcity 9 and run Unit tests for my Visual Studio solution.
I have a Windows Phone 8.1 project (WinRT, not silverlight) and a portable class library MyProject.Common.dll with shared functionality.
I created a < Windows Phone Unit Test App project . If I run it from VS, it runs on the emulator and runs my unit tests. It's okay.
If I want to run unit tests from the console , I use this command:
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe MyProject.Tests_1.0.0.1_x86.appx /InIsolation /settings:RunOnEmu.runsettings"
It works. It launches the emulator, deploys applications, and runs unit tests.
Now the problem : using Teamcity 9, I am setting up the runner using the command line using the same command and I am getting this error:
Error: Unable to run test run tests for Windows Phone app: Unit tests for Windows Store apps cannot be run from a service or without an interactive process. Conduct unit tests with an interactive process ..
Is there a way to get around this error?
source to share
There is another way to work around this: run the build agent as executable, not as a service. You can achieve this by removing the TeamCity service:
service.stop.bat
service.uninstall.bat
(all .bat files are in bin folder in TeamCity build agent)
Then create a new .bat file to run the build agent as executable:
C:\TeamCity\buildAgent\bin\agent.bat start
And by adding a shortcut to this file in your startup folder in C:\Users\%user%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
and setting automatic login as described here . Therefore, the build agent will start automatically upon reboot.
I found this solution here with some other common Windows Store benchmarks issues and solutions.
source to share