none
Automatically starting Interactive Build Host to run Coded-UI test

    Question

  • Hi...

    Being fairly new to TFS build I was able to have a build run some Coded UI tests on a WPF application.  I don't own Test Manager / Lab Management tools.

    To do this, I needed to run the build agent as an interactive process (Build service property, Run as Interactive Process), I created a test controller and an interactive test agent.  Works fine but I always need to manually start the build service(as it's not a windows service anymore). 

    I'm surely missing something here...  I want a nightly build that will run the UI tests and a CI build that will run only the unit tests after each check in...

    Is there a way to do this within the same build machine without having someone starting the host everytime?

    Thanks!

    Wednesday, April 28, 2010 7:55 PM

Answers

  • If you set up HKEY_CURRENT_USER registry only then tfsbuildservicehost will be started only when this user logs on. If you want everyone to be able to start tfsbuildservicehost (not your case!) you set up HKEY_LOCAL_MACHINE registry key. Select the right key and you will get what you want.

     

    Monday, May 03, 2010 10:35 PM

All replies

  • To setup your tfsbuildservicehost to start on reboot you need to do the following:
    1. Configure you tfsbuildservicehost as an interactive process for a certain running account.
    2. Setup this running account as autologon account.
        See
    http://support.microsoft.com/kb/310584.
    3. Setup you process as a startup process.
       I managed to do it by adding an entry to Registry: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run.

      HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run.
    4. Reboot...

    Of course, currently it will try restart BSH as a service, too (leaving an error in the Event Log) so you will have to stop the window service to avoid these errors.

    • Proposed as answer by Julia Lavrova Thursday, April 29, 2010 3:27 PM
    • Unproposed as answer by Benoit Rochette Friday, April 30, 2010 6:37 PM
    Thursday, April 29, 2010 3:19 PM
  • Hello Julia and thank for you proposal, i was intrested in the question too.

    But i still can't trigger and run builds,  next issue appears on win2k8 x64 with tfs2010 rc:

    -I added required entries for  domain/user/passwd in registry for autologin

    -I added entry in registry in both HKEY_LOCAL_MACHINE and  HKEY_CURRENT_USER for start up  process

    C:\Program Files\Microsoft Team Foundation Server 2010\Tools\TFSBuildServiceHost.exe

    -After reboot:

    user is auto logged in- ok

     tfs build service is started in interactive mode - ok(but 2 promts launched)

     but if open TFS management console and check ApplicationTier->BuildConfiguration section there is next info:

       about service started under correct user in interactive mode - ok

       controller state is unknown - it's strange

       agent state is unknown - it's strange

    If try to manually start build from vs by build definition - get error

    TF215097: An error occurred while initializing a build for build definition \ProjectName\wfTesting: There was no endpoint listening at http://TFSSERVER:9191/Build/v3.0/Services/Controller/2 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

     

     Any ideas?


    Friday, April 30, 2010 9:34 AM
  • Thanks Julia for the reply..

    Same problem here...

    Controller and agent are in an unknown state, the build was able to run one coded test though

    I got error like this Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotAvailableException: The control is not available or not valid

    Finally, i had to stop the build cause it was never ending... 

    One other problem that I have is that everyone that will connect to the build server will have a build host started...  Is there any way to avoid this (to have it launch only for the specific running account)?

    Thank you very much for your support!

     

    Friday, April 30, 2010 6:47 PM
  • If you set up HKEY_CURRENT_USER registry only then tfsbuildservicehost will be started only when this user logs on. If you want everyone to be able to start tfsbuildservicehost (not your case!) you set up HKEY_LOCAL_MACHINE registry key. Select the right key and you will get what you want.

     

    Monday, May 03, 2010 10:35 PM
  • I have everything working up to the point where the status of the build ageny is "unknown state".  Has anyone been able to get the interactive builds to work when they are automatically logged in and started up?
    Tuesday, June 15, 2010 10:09 PM
  • Since you added 2 registry keys (Local Machine and Current User) you have 2 prompts launched. One of them should fail for sure since only one tfsbuildservicehost is allowed. What these prompts show? Second one may show another error that would help us to understand what is going on. If you take out one of the registry keys it could help.

    "Unknown state" is not a state for a controller or an agent. It only means that TFS Management console cannot connect to tfsbuildservicehost.

    The error you had when you started a build shows that tfsbuildservicehost is not started properly.

    Last question: did you condigured you tfsbuildservicehost as a current user (the one that is auto logged on)?

     

    Tuesday, July 13, 2010 1:38 PM
  • "Unknown state" is not a state for a controller or an agent. It only means that TFS Management console cannot connect to tfsbuildservicehost. You need to find out why tfsbuildservicehost is not running properly. Command prompt that started tfsbuildservicehost should show you what was the problem. You can also take a look into Event Log - it must be logged there.

    Tuesday, July 13, 2010 1:41 PM