Coherent GT  1.10.0
A modern user interface library for games
Test Driver Support

Coherent GT provides a webdriver for performing tests on the UI of your application.


  • PhantomJS needs to be installed on your machine in order for the Test Driver to run.
  • The pages to be tested should include the "coherent.js" script.
  • "TestDriver.dll" should be present in the folder containing the executable of your application. The "test_driver" folder should also be included there unless you have explicitly set a different location for it via the TestDriverResourcesFolder of the SystemSettings structure.


To use the Test Driver with your application the TestDriverPort of the SystemSettings structure should be set to a port number where the Test Driver can connect. In the sample applications this is facilitated via a "--webdriver=" command line argument.

A system listener can be set using the application's SetSystemListener method. If the listener implements CreateView it should return the view that the test driver will listen for events on and use for tests, otherwise a new view will be created. Once the test is completed the listener's TestRunDone method is called which can be used to close the application for example. Here is how they are implemented in our samples:

virtual Coherent::UIGT::View* CreateView(const Coherent::UIGT::ViewInfo& , const char* url)
auto view = m_Application->GetView();
if (url)
return view;
virtual void TestRunDone() override
void SetApplication(SampleApplicationBase* app) override
m_Application = app;

Running tests

Tests can be run using the Selenium WebDriver API. It is important to initialize PhantomJS with the path to the executable you wish to test and a port number and to also set the appropriate working directory. The names of the test methods should begin with test. The following Python example demonstartes a test that checks that the loaded page contains 'Document' in its title:

1 import selenium
2 import selenium.webdriver
3 import unittest
5 class GTTestCase(unittest.TestCase):
7  def setUp(self):
8  self.browser = selenium.webdriver.PhantomJS(executable_path=r'path_to_executable', port=8910, desired_capabilities = {})
10  def tearDown(self):
11  self.browser.quit()
12  return super(GTTestCase, self).tearDown()
14  def test(self):
15  self.assertIn('Document', self.browser.title)
17 if __name__ == '__main__':
18  unittest.main(verbosity=2)