9

I run MSTest to test WPF application (Coded UI Test) on a VM using Teamcity. I already installed test agent as interactive process but i keep getting this error in Teamcity log

Error calling Initialization method for test class Squarebit.Apms.Terminal.Wpf.Test.CodedUITest1: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with the desktop, you must set up the test agent to run as an interactive process. For more information, see "How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop" (http://go.microsoft.com/fwlink/?LinkId=255012)
If you are running the tests as part of your team build, you must also set up the build agent to run as an interactive process. For more information, see "How to: Configure and Run Scheduled Tests After Building Your Application" (http://go.microsoft.com/fwlink/?LinkId=254735)
   at Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize()
   at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestExtensionExecution.BeforeTestInitialize(Object sender, BeforeTestInitializeEventArgs e)
   at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecution.RaiseBeforeTestInitialize(BeforeTestInitializeEventArgs args)
   at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()

Can you help me resolve this problem or recommend some ways to run Coded UI Test using Teamcity?

Bruno Bieri
  • 7,754
  • 10
  • 55
  • 79
Gintama
  • 1,073
  • 19
  • 29
  • 3
    CUIT tests can't run from a service account since they need access to Desktop Windowing API set. Please refer "Installing the teamcity build agent" section in http://jake.ginnivan.net/teamcity-ui-test-agent/ to setup teamcity agent as a non-service account. – Arun M Jul 23 '14 at 04:48
  • @ArunM - You should copy your comment as an answer so Gintama can mark it as the correct answer. – Philip Pittle Jul 24 '14 at 09:41

1 Answers1

7

Coded UI tests (CUIT) can't run from a service account since they need access to Desktop Windowing API set.

Please refer Installing the teamcity build agent section in http://jake.ginnivan.net/teamcity-ui-test-agent/ to setup teamcity agent as a non-service account.

Bruno Bieri
  • 7,754
  • 10
  • 55
  • 79
Arun M
  • 1,432
  • 8
  • 13
  • I'm trying to do something similar before I move onto TC. I want to get it working using a simple batch script executed remotely. Runs fine locally, CUIT, all pass as expected. They fail when I try executing them remotely. I haven't looked into the interactive process thing yet. – IbrarMumtaz Sep 09 '14 at 16:05