Unit Tests

Unit tests are fundamental part of open source software development. Before every commit test the functionality you have changed, ideally test the whole project, however running all the tests can take a lot of time since some tests include executing the UT2004 server and performing tests inside the environemnt (eg. navigation).

Configuring environment for running the test

Some test need to have a running UCC server with Gamebots installed. Fortunately you don't have to run the server manually each time you want to execute the tests. Instead you simply set pogamut platform variable pointing to the UT2004 installation:

  • pogamut.ut2004.home=c:\games\UT2004 - points to the install directory of UT2004, eg. c:\games\UT2004

Tests will ten execute the UCC on their own.

If you want to observe your bots performing the tests then it is convenient to to make the tests use externaly executed instance of UCC because then you can connect to it with viewer in advance. To force this behaviour set variable:

  • pogamut.test.useExternalUCC=true

Pogamut platform variables can be set as ordinary system environemnt variable, or you can set them throufh -D JVM option, or in PogamutPlatformCustom.properties file.

Coding new tests

The tests are implemented in JUnit 4.5, for tutorial on writing a basic test see http://junit.sourceforge.net/doc/cookbook/cookbook.htm

Pogamut provides a few base classes that provide infrastructure for writing PogamutUT2004 test cases. These test base classes are located in package cz.cuni.amis.pogamut.ut2004.testbase. See Javadoc of these classes. And learn from other classes extending these.