Q:

Travis CI - Run LWJGL Tests in Non-Headless Environment?

I'm trying to run some tests on Travis CI that require a server that's, err... Not headless. As you can tell, I know so little about the area I don't even know the right terminology to use.
The tests use LibGDX and LWJGL. They work fine on my desktop (Windows 8 and Ubuntu), but unsurprisingly fail in Travis CI:
Could not initialize class org.lwjgl.Sys
    at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
    at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setVSync(LwjglGraphics.java:446)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:118)

Can I do anything with Travis CI to make it think it has a proper display? Even if this is not possible with Travis CI, is there a generic approach that I could perhaps take with another VM I have more control over?

A:

This can be done with xvfb. In your travis.yml, add this:
before_script:
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start

You will have to install xvfb if you don't already have it. You may also have to install the other libs/packages needed by your tests on the VM (for e.g. for web app tests, you would need a browser).

