Org.simantics.db.tests

From Developer Documents
Revision as of 11:29, 29 September 2010 by Toni Kalajainen (talk | contribs)
Jump to navigation Jump to search

Introduction

This package provides small set of tests for testing DB subsystem. Testing is divided into suites for different purposes as follows:

  • Regression: This suite is designed to verify the main functionality of the system. It should be run as often as possible when something changes.
  • Performance: This suite is designed to benchmark the solution.
  • Stress: This suite is designed to ensure long-term functionality of the solution. These tests are demanding and can only be run at selected times.

Requirements

  • Individual tests and test suites can be run automatically or manually.
  • Handling of global paramters. These are among others:
    • running against virtual graph or server graph
    • transaction policy
    • java vm size
    • etc
  • Reporting of test results.
    • for individual tests and suites
      • performance time
      • configuration
    • history of previous tests

Running tests manually

Automated tests are run as ant script by hudson. The script is build.xml file in org.simantics.db.tests directory. The tests expect the same environment as the development environment for the db client i.e. org.simantics.db.build, etc.

The script needs to know where the target directory is. Target directory is the directory containing those dependent plugins that are not part of db client code, e.g. org.simantics.databord, etc. The default target directory is "${user.home}/target/1.1". If this is not correct give the correct path with "-Dtarget.dir=<correct-path>".

  • Command "ant basic" runs the regression tests.
  • Command "ant quality" runs the performance tests.
  • Command "ant large" runs the stress tests.

Running tests in Eclipse

Set up the test environment by running "ant build-env". After this you can launch the tests from org.simantics.db.tests.launch directory in eclipse.

Running tests in Hudson

The automated tests are run by Hudson. See [1]. The automated tests are run every night and the test environment is reloaded if there are any changes in the source plugins. See svn-externals properties [2] which is used by hudson to load tests environment. The target platform directory svn:target/branches/1.1 is not currently loaded automatically.

Writing tests using DB

Use the following test template:

public class TestXXX {
    
    Session session;
    
    @Before 
    public void connect() throws Exception {
        // Try to load and register the Driver instance with the driver manager
        Class.forName("fi.vtt.simantics.procore.ProCoreDriver");

        // Connect to the server at the specified host and credentials.
        session = Manager.getSession("procore", InetSocketAddress.createUnresolved("localhost", 6667), 
                "Default User", "");        
    }
    
    @After
    public void disconnect() throws Exception {
        session.getService(LifecycleSupport.class).close(); 
    }
    
    @Test
    public void sometest() throws Exception {
        // using session
    }
    
}

The plugin must have org.simantics.db in dependency list and org.simantics.db.procore in imported packages list. Run the test as a plug-in test. It is enough to include the plugin org.simantics.db.procore.protocol and all its requirements to the run configuration of the test. You must run ProCore manually in port 6667 for the test to work.

Download

Version SVN Source Tag
1.1.0 svn:db/tags/1.1.0/


Change Log

1.2

  • ...

Roadmap

1.2

  • Initial stab at regression test suite.
  • Initial stab virtual graph, transaction policy and vm parametrizations.