in reply to Including a Gtk2 app in a Test

Look at what Mac::Carbon does for its gui tests. And check if $ENV{DISPLAY} is set and skip the tests if it's not.