[Avocado-devel] RFC: Test Developers API

Ruda Moura rmoura at redhat.com
Fri Mar 27 15:39:44 UTC 2015


Test Developers API
===================

>From the discussion we've been doing so far, there are four
major ideas emerging to give the test developers
a clear instruction on what is the API for creating
tests in Avocado.

https://trello.com/c/ENlP9vAu/351-study-review-test-api-set-a-boundary-for-test-writers


1. Export Test developers API in avocado main module
----------------------------------------------------

Just export the classes, methods and functions
inside the avocado.__init__ module.

  from avocado import 
  avocado.Test, avocado.run, avocado.build, etc.

If we defined __all__ = [Test, run, system, etc.]
then we can even control what the users will
get if he/she does 'from avocado import *'.

Unittest and nose does it.


2. Export Test developers API in submodule avocado.api
------------------------------------------------------

In this case, avocado.api or avocado.testing or any better name,
contains the whole API for test developers.
The point here is to isolate the test API in a submodule.

It has a clear border for test developers.
So it will contain Test classes and methods, 
functions to run process, logging etc.

The Fabric project does it (see fabric.api).


3. Using a different namespace than avocado
-------------------------------------------

We just create a different namespace (like avocado_core),
instead of using everything under avocado.
We will keep the test API under a new
namespace avocado_core or avocado_framework.

The drawback here is how to manage separated projects.


4. Test Developers: "Don't use avocado.app"
-------------------------------------------

This is a different approach than the others above.
In this case, we concentrate everything that isn't 
for test developers under a new submodule avocado.app.

Everything related to plugins, parsing of command line,
logging, and any stuff target to the application, goes to avocado.app.
So the test developers can use everything else from avocado.

The potential problem here is cyclical dependences.


-- 
Rudá Moura




More information about the Avocado-devel mailing list