while you want run coded ui or other ui automation test cases for integration on jenkins or tfs ,may be will got the following error message :
Automation engine is unable to playback the test because it is not able to interact with the desktop. This could happen if the computer running the test is locked or it's remote session window is minimized..
or
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).
you can follow my two artices to fix it .
Auto start build agent in interactive mode
you are welcome :)