Recently we found our integration test failed unexpected with following exception:
We even remeber that we have changed nothing to TFS BDT workflow and test case.
Error exception:
Error calling Initialization method for test class UITestDemo.UITestDemo01: 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)
Error Stack Trace:
Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize() Microsoft.VisualStudio.TestTools.UITesting.CodedUITestExtensionExecution.BeforeTestInitialize(Object sender, BeforeTestInitializeEventArgs e) Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecution.RaiseBeforeTestInitialize(BeforeTestInitializeEventArgs args) Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()
We have no idea how to fix it.
After investigation, we found that test is running by account: "computerName$" on environment, not the specified account in test controller settings.
Solution: We open the using test settings in MTM test settings manager. And recheck each environment should run test on correct role.
Then retest run pass.