August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)

Kamaelia: Testing Framework

What is it?

NOTE/WARNING: this is a speculative project that may become "the" testing framework. It does not have that status yet.

Kamaelia Testing Framework aims to be a testing framework that will let developers write automated tests of kamaelia components easily.

NOTE: this documentation is related to the first stage of the project, which has been suggested to be rewritten, so it may change completely in the near future.

Where do I get it & install it?

developers

It is currenty available in the private_PO_Tests branch. So, step by step:

Enjoy

How do I use it?

Once the system is installed, you can do the tests you want wherever you want (i.e. in your /Sketches, in /tmp, etc.).

You need to import the class "KamTestCase" from the package Kamaelia.Testing.KamTestCase and subclass it

In this subclass, you can use setUp and tearDown just as you would do in PyUnit.

You can test code that has nothing to do with Axon.

If using Axon (which is the normal thing):

In order to provide some working examples, you can check:

There are some other (more complex) tests added:

Since it relies on PyUnit, it can easily be integrated in continuous integration servers with the existing tools for integrating PyUnit on them.

Planned Schedule (July 7th: redefining it):

June 6

June 13

June 20

June 27

July 4

July 11

(not added Logging Framework schedule)

Progress (dates related to the weekly meeting - these are the "DONE" lines)

Log/Discussion

First approach:

scheduler steps-based. 

Available prior to r4391 (with examples in KamPlanet tests), still available as KamPlanetTestCaseOld.py

Second approach:

time-based and expect command based

Suggested by ms-

Now it asserts that the task has failed when certain seconds have passed

You can also assert that you wait for a certain output, discarding all the previous output. Or that the component output is empty (equivalent to expect's EOF).

Advantage: it is more realistic than the previous approach, and more compfortable.