back to index     prev     next  

0.1 Structure of the API

Goals of the API

Functional Tests & Benchmarks

Test definition

A Test runs successfully of :

Benchmark definition

Benchmark is a Test, its result is a time.

Interlinked Functional Tests

First, we specify parents Tests.

To do this, just overload Action method with needed inputs and outputs, after, with the Java reflection mechanism we found the first good Action method to execute the Test.

Mechanism in details

In standalone mode the test runs with this method :


void action() throws Exception;

In interlinked mode, the developer must to add a similar method in his code Test :


A action(B toto, C tutu, …) throws Exception;

Where toto is the result output of the first parent of this test and tutu the result output of second parent, … A is the type of result output of this Test.

Reflection code

Find the first action method :


 Method[] methods = getClass().getMethods();
            Method actionWithParams = null;
            for (int i = 0; i < methods.length; i++) {
                if ((methods[i].getName().compareTo("action") == 0) &&
                        (methods[i].getReturnType().getName().compareTo("void") != 0)) {
                    actionWithParams = methods[i];
                    break;
                }
            }

Array of params type :


            if (actionWithParams != null) {
                Object[] args = null;
                if (tests != null) {
                    args = new Object[tests.length];
                    for (int i = 0; i < tests.length; i++)
                        args[i] = tests[i].getOut();
                } else {
                    args = new Object[1];
                    args[0] = null;
                }

Call the method :


out = actionWithParams.invoke(this, args);

Group

What is a Group of Tests ?

What is the role of a Group?

Manager

What is a Manager in Testsuite API ?

What is the role of a Manager?

We have different types of Manager to better manage of specialised Tests or Benchmarks :

Diagram of classes

The follow image presents the main structure of the API :

Classes details :

General structure at runtime :

Test classes diagram :