4

I've been struggling to make Teamcity 9 compile and run Unit Tests for my Visual Studio solution.

I have a Windows Phone 8.1 (WinRT, not silverlight) project and a "MyProject.Common.dll" portable class library with common 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. All is Ok.

If i want to run the unit tests from a 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 the appx and run unit tests.

Now the problem: using Teamcity 9, i configure a command line build step runner using the same command , and i get this error:

Error: Could not start test run for the tests for Windows Phone app: Unit tests for Windows Store apps cannot be run from a service or non interactive process. Please run unit tests from an interactive process..

Is there a way to bypass this error?

Andrei Ashikhmin
  • 2,401
  • 2
  • 20
  • 34
Herno
  • 1,497
  • 2
  • 21
  • 40

3 Answers3

2

In the end, i made a custom script to launch vstest.console.exe and run the unit test appx and then another Build Step to load the tests results into TeamCity.

Herno
  • 1,497
  • 2
  • 21
  • 40
  • Hi, @Herno I've run into the same problem as you and the way I tried to solve it was running a custom powershell script but I still get the exception you mentioned. Could you please add some more info on how you solved this issue? Thanks. – Cristian Badila Aug 13 '15 at 17:11
  • Hello. I programmed a small C# program to launch the console. I could not bypass the error. If you want the source code i can share it, let me know – Herno Aug 13 '15 at 19:15
  • Aha, I understand now. That was what I was thinking of doing next. It would be a nice idea if you could post the code on github or as a gist so that if anybody else runs into this issue they could fix it faster. Thanks again! – Cristian Badila Aug 14 '15 at 07:16
2

There is another way to bypass that - run build agent as executable and not as a service. You can achieve that by removing TeamCity service:

service.stop.bat
service.uninstall.bat

(all .bat files are in bin folder of TeamCity build agent)

Then create new .bat file to start the build agent as an executable:

C:\TeamCity\buildAgent\bin\agent.bat start

And placing shortcut to this file into startup folder in C:\Users\%user%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup and setting up automatic logon as described here. That way build agent will start automatically after reboot.

I found this solution here with some other common problems and solutions regarding Windows Store tests.

Andrei Ashikhmin
  • 2,401
  • 2
  • 20
  • 34
1

Change Jenkins configuration for the needed slave. Within the option "Launch Method" now it's probably "Let Jenkins control this slave as a windows service", but you need "JLNP" (Java Network Launch Protocol):

enter image description here

Stan E
  • 3,396
  • 20
  • 31