Self Testing Framework

As VODesktop connects to many different external services, there are many things out of it's control that may go wrong. In addition, VODesktop itself listens at various ports for connections from external processes calling SAMP, Plastic, or AR functionality. Frankly, there's a whole bunch of things that can go wrong, especially on oddly configured laptops with broken networking.

The VODesktop self tests can be accessed from the main menu bar - Window - Run Self Tests. According to user preferences, the self tests are run automatically at startup. Whether run manually or at startup, any errors in the selftests are logged.

Adding a new self-test

The intention of self-tests is that they should be used to verify that the network is accessible, file locations readable etc - i.e. things that might go wrong in a usage environment. Self tests aren't a good place to put functionality and coding tests - which should be part of the main test tree.

Self tests are expressed in the JUnit framework. New self tests should be contributed to the hivemind configuration point util.selftest. Each contribution must either be a JUnit TestCase or TestSuite object.

Two main ways of implementing self tests occur in the code

  1. Either write conventional top-level Junit test classes, and instantiate these in the configuration point. This is best for stand-alone environmental tests (e.g. memory, JVM version, network connectivity). See implementation and hivemind conf for org.astrogrid.desktop.modules.util.ConnectivityTests as an example
  2. Or have a service implementation provide access to it's self test object (TestCase or TestSuite) through a property getter method. This self test is typically implemented as an inner class of the service implementation. This provides better access from the test to the internal state and configuration of a component (e.g. submitting test queries to an ivoa registry). See implementation and hivemind conf for org.astrogrid.desktop.modules.system.JettyWebServer for an example of this approach.

For further examples, consult the hivedoc