Because GoCD installs itself as a service (Windows) or daemon (Linux) by default, getting GoCD agents to interact with your operating system’s windowing environment can cause problems. Access to a windowing environment is usually required for testing UI applications or for driving browsers for web testing. Here’s how you do it.
The first step is to disable the GoCD agent service. To do this:
- Log in to your Windows machine as an Administrative user.
- Click on Start → Control Panel → Administrative Tools → Services.
- Double click on ‘Go Agent’.
- Change the Startup Type to ‘Disabled’.
- Click ‘Stop’ to stop the service.
- Click ‘OK’ to finish.
The next step is to start the GoCD agent as an application.
- Click on Start → All Programs → Go Agent → Run Go Agent.
- To get the GoCD agent to start every time you log in, copy the Run Go Agent shortcut to the Startup folder of your start menu.
There are many different ways to get a Linux build agent to interact with a UI. The easiest is to use a VNC service (or
xvfb) to provide a dedicated X11 server to your agent. To do this:
- Install the VNC server and fvwm packages for your distribution. (aptitude install vnc4server fvwm / yum install vnc-server fvwm)
- Sudo to the ‘go’ user (sudo su - go) and do the rest as that user
- Set a password for remote access to your VNC server with the command ‘vncpasswd’
- Edit your VNC config to use fvwm and not twm as the window manager. (replace twm with fvwm in ~/.vnc/xstartup)
- Edit the file
wrapper-properties.confand set the
DISPLAYvariable to an appropriate value.
Restart your agent and it will now have access to an X11 server that you can also connect to with your favourite VNC client.
- If there are any other environment variables that need to be set for your UI testing tools, they correct place to set these is in your
wrapper-properties.conffile. Don’t forget to export them!
- You can connect to your session with vncviewer to see what’s going on. Use
- If things appear to hang, chances are you forgot to replace twm with fvwm. twm requires you to place a window on the desktop when it starts up