Meego Wiki
Views

Quality/QA-tools/OTS/CreatingAPublisher

From MeeGo wiki
Jump to: navigation, search

Contents

Writing a Publisher

The ability for OTS to publish the information from the Testrun is an essential feature.

The standard distribution of OTS comes with a Publisher for sending results to via email. This Wiki shows you how you can easily extend OTS with your own Publishing Tool.

What is a Publisher?

Publishers allow the harvesting and visualisation of data from a Testrun. The OTS framework provided is designed to allow integration with your internal systems, whether they be third-party software (e.g. a web based reporting tool) or quick-hacks to solve immediate issues (e.g. An SMS alarm system for failing Testruns)

Cooking Eggs

OTS uses the common Python distribution mechanism provided by setuptools. This also forms the basis of the Plugins.

There is plenty of third party documentation for this (for example this Wiki from the Trac Project). But hopefully the following HowTo and example will show you all that you need to know to start hacking.

Cross Referencing Between Publishers

We have found that Publishers tend to be interdependent and this is supported by OTS. For example an Email Publisher might want to incorporate links to a web bases Reporting Publisher in an email message.

How to create a Publisher

This example shows a very simple publisher written in PySide. The complete code listing is in the OTS source tree.

1. Publisher API

Your Publisher should support the interface suggested by PublisherPluginBase.

Check out the PySidePublisher example.

2. setup.py

The Entry point in setup.py should be:

[ots.publisher_plugin]

3. Adding the Publisher to OTS

OTS can pick up the Publisher either as a formal installation or as a Plugin.

One way to contribute to OTS is to install directly from the source code on the target:

 python setup.py install

The following steps describe other means of contributing a Publisher to OTS.

4. Building an Egg

In the same directory as setup.py

 python setup.py bdist_egg

The build Egg can be seen in the dist sub-directory

The Egg is a distributable. It can be installed using:

 easy_install PySidePublisher-0.8-py2.6.egg

5. Debian / RPM

Package management is another option.

A Debian package can be created and setuptools allow for direct creation of RPMs

 python setup.py bdist_rpm

6. A Publisher Plugin

If you want to take more of a 'Plugin approach' with your Publisher just move the Egg you have just built (in the dist sub directory) into the plugins directory.

Currently under ots.server/ots/server/plugins. FIXME make more user friendly

7. Running the demo

Run the demo

python demo_pub_plugin.py

This shows how the Publisher Plugin in action. Stubs are used to mimic a Testrun

Personal tools