Org.simantics.db.tests

From Developer Documents
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}/targetDir". If this is not correct give the correct path with "-Dtarget.dir=<correct-path>".

  • Command "ant regression" runs the regression tests.
  • Command "ant performance" runs the performance tests.
  • Command "ant stress" runs the stress tests.

Running tests in Eclipse

Each test has its own launcher in launch directory and corresponding java class:

  • RegressionTests.launch and RegressionTests.java
  • PerformanceTests.launch and PerformanceTests.java
  • StressTests.launch and StressTests.java
  • TempTests.launch and TempTests.java

Either run the launcher with run as junit test or open the class and run it as junit test. Note that the latter only works if you use run as junit. If you for example choose run as junit plugin test then eclipse will modify the launcher and thing will not work.

If you are using 64 bit eclipse the only way to get the tests working at the moment is to use 32 bit JRE.

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.