Skip to content
micskeiz edited this page Dec 15, 2014 · 2 revisions

Extending SETTE

There are two ways to extend SETTE. You can use either your own code snippets instead of the ones written by us, or you can implement support for a new test input generator tool and integrate it to SETTE's workflow.

1. Developing an Own Set of Code Snippets

In order to create your own set of code snippets, we advise to check the source of our code snippet's (sette-snippets repository). First, let's see an example code snippet:

@SetteSnippetContainer(category = "B2",
        goal = "Check constraint solving for linear expressions",
        inputFactoryContainer = B2d_Linear_Inputs.class)
public final class B2d_Linear {
    private B2d_Linear() {
        throw new UnsupportedOperationException("Static class");
    }

    /**
     * Equation: 20x+2 = 42<br/>
     * Solution: x = 2
     *
     * @param x
     * @return
     */
    @SetteRequiredStatementCoverage(value = 100)
    public static boolean oneParamInt(int x) {
        if (20 * x + 2 == 42) {
            return true;
        } else {
            return false;
        }
    }
}

As you can see, one or several code snippets can be stored in a snippet container. The snippet container must be indicated by the @SetteSnippetContainer annotation, while the @SetteRequiredStatementCoverage annotation must be applied on methods which function as code snippets. The annotations can be found in the sette-common project, so it must be referenced. However, you should not make any other references to SETTE. In the code snippet methods, you can use other classes and call other methods. For further information on SETTE annotations check the JavaDoc of the sette-common project.

In addition, a code snippet project always has a configuration file (sette-snippets.properties) and may have several referenced libraries. Each code snippets can have a corresponding file, which contains the inputs for them to reach the desired coverage. There is an example for the code snippet above:

public final class B2d_Linear_Inputs {
    private B2d_Linear_Inputs() {
        throw new UnsupportedOperationException("Static class");
    }

    public static SnippetInputContainer oneParamInt() {
        SnippetInputContainer inputs = new SnippetInputContainer(1);

        inputs.addByParameters(2);
        inputs.addByParameters(0);

        return inputs;
    }
}

For further information, check the JavaDoc.

2. Integrating Another Tool Into SETTE's Workflow

The following figure summarizes the project architecture of SETTE.

SETTE projects

  • sette-common: mainly contains annotations for describing code snippets
  • sette-base: common SETTE classes and internal workflow implementation
  • sette: UI and tool-specific classes

To integrate a new tool into SETTE's workflow, we highly recommend to check the sette project. Currently 3 tools are integrated (CATG, jPET, Symbolic PathFinder) and they should make a good example. The base classes follow the template method design pattern, so you should only implement

  • how to generate tool-specific files for a code snippet (generator)
  • how to execute the tool on one code snippet and (runner)
  • how to parse the tool's output into the common XML format (parser).

In addition, several helper classes (such as ProcessRunner) have been implemented formerly, so you can use them. We highly recommend not to modify the sette-base project.

If you have any difficulties in developing your own code snippets or integrating another tool, please do not hesitate to contact us.

Clone this wiki locally