### Knopflerfish OSGi regression tests

This directory contains regression tests which can be used to test OSGi frameworks. Almost all of the tests originates from the Gatespace Telematics test suite. These test are now donated as BSD-licensed open source, via the Knopflerfish project.

The tests can be compiled standalone from the main KF distrib, by just checking out the regression_tests/ dir and compile using ant:

     > svn co \
    https://www.knopflerfish.org/svn/knopflerfish.org/trunk/osgi/bundles_test/regression_tests
     > cd regression_tests
     > ant -Dosgi.jar=<path to osgi lib>

...and you'll get a new dir jars/, full of test bundles.

The KF nightly build runs these test, and saves the results at
http://www.knopflerfish.org/snapshots/trunk/junit_grunt/index.xml

A precompiled zip file of the necessary test bundles can be found at
http://www.knopflerfish.org/snapshots/trunk/knopflerfish_osgi_tests_1.3.2-trunk.zip

The tests can also be accessed/browsed using subversion, from
https://www.knopflerfish.org/svn/knopflerfish.org/trunk/osgi/bundles_test/regression_tests/

#### Available test suites

Bundle | Test id | Passes on
--- | --- | ---
framework_test-1.0.0 | FrameworkTestSuite | KF
filter_test-1.0.0.jar | FilterTestSuite | KF
servicetracker_test-1.0.0.jar | ServiceTrackerTestSuite | KF
constants_test-1.0.0.jar | ConstantsTestSuite | KF, Oscar
permissionadmin_test-1.0.0.jar | PermissionAdminTestSuite | KF
registeryperformance_test-1.0.0.jar | PerformanceRegistryTestSuite | KF
http_test-1.0.0.jar | HttpTestSuite | Only half-complete
restart_test-1.0.0.jar | RestartSetupTestSuite + RestartTestSuite | KF

and a lot of small test bundles `bundle[A-Z]_test` which are used as embedded bundles.

#### Test source, origin, errors, updates

Most of the tests have been ported from a log-based test system, to a JUnit-based system (see JUnit testing on OSGi), and the test in themselves may thus contain porting errors.

Reviews are encouraged! Please report any possible test errors, new tests, suggestions, or new platforms that the tests have been run on, to info@knopflerfish.org

#### Running the tests

The test cases above can be run using the junit bundle. It can also be run without the http server, using the junit_runner bundle.

To run a standalone tests you should only need to install

     junit_all-1.0.0.jar

then the one or more of the actual test cases

     framework_test-1.0.0.jar       (test id: FrameworkTestSuite)
     filter_test-1.0.0.jar          (test id: FilterTestSuite)
     servicetracker_test-1.0.0.jar  (test id: ServiceTrackerTestSuite)
     constants_test-1.0.0.jar       (test id: ConstantsTestSuite)

the last started bundle should be

     junit_runner_all-1.0.0.jar

which reads system properties

     org.knopflerfish.junit_runner.tests=[space separated test ids or filter]
     org.knopflerfish.junit_runner.quit=true

When the framework is started, the junit_runner bundle will run all installed test and write the XML results to a directory (including XSLT styles for HTML presentation). The default output directory is `junit_grunt1`

An KF .xargs file doing exactly this can be found at init-tests.xargs. This is the same file used for the nightly test runs.

#### Running the restart tests

The `restart_test` bundle is intended to test framework behavoir after a restart. This requires the system triggering the test to start the framework twice, first in a completely clean state, then in a restarted state.

The first run will install a set of bundles (at different start levels) and then quit.

The next run should start the framework in a restarted mode. The restart bundle will notice this by using the bundle file storage, and compare the state between the two runs.

These .xargs startup files can be used as example for running the restart tests:

restart_test/test-restart1.xargs
restart_test/test-restart2.xargs

1Hi Klas!

Copyright 2004 Knopflerfish