Skip to content
A unit test suite for OpenBabel
Find file
New pull request
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


A regression test suite for OpenBabel

Yes, OpenBabel already has a test suite, but the more tests the better.

This test suite is written in Python, and currently focuses on regressions (although any test is welcome). The current tests are named after the entries in OpenBabel's bug tracker (go to, click on Trackers, then Bugs).

How to download

One way is to click the download button at

A better way is to install Git. On Windows, you can install Git under Cygwin. Then use the following command:

git clone git://

With Git, you can stay up to the date with the latest version by just typing "git fetch", then "git pull origin master".

How to run

To run all tests:


To run one test:


How to add a test

Copy an old test, rename it, edit it, and email me the result.

A better way is to fork the repository on Github, "git clone" your fork, make your changes, "git push" it to github, and then send me a pull request.

What's a good test?

A poor test is very specific to the bug or feature being tested. It tests nothing else and will only fail if a very specific problem occurs.

A good test maximises the chances of failing. It should fail if the specific problem occurs, but it should also fail if any 1 of a 100 things goes wrong.

From the point of view of maintaining tests, a good test should not rely on anything that may change in the future. If a test fails, it should indicate an error in OpenBabel, not an error in the test.

How to serialise a molecule

Given a molecule in a file, you can create a serialised version using:

python serial myfile.mol

Copy and paste the result into your test file to ensure that the molecule's atom types and bond orders are correctly perceived in all future OpenBabel versions. See testIdentity in for an example of usage.

Something went wrong with that request. Please try again.