1

I am using the Model Junit Librarys DFS class to create a spanning tree out of my FSM.

This is my code:

public static void main(String args[]) throws FileNotFoundException {
    // create our model and a test generation algorithm
    Tester tester = new RandomTester(new FSM());
    // build the complete FSM graph for our model, just to ensure
    // that we get accurate model coverage metrics.
    tester.buildGraph();
    // set up our favourite coverage metric
    CoverageMetric trCoverage = new TransitionCoverage();
    tester.addListener(trCoverage);
    // ask to print the generated tests
    //tester.addListener("verbose");
    // generate a small test suite of 20 steps (covers 4/5 transitions)
    tester.generate(20);
    //tester.getModel().printMessage(trCoverage.getName() + " was " + trCoverage.toString());

    GraphListener gl = tester.buildGraph();
    gl.printGraphDot("/Users/mahsaabbasian/Documents/workspace/ModelJunit/src/modelJunit/file.dot");
    InspectableGraph graph1 = gl.getGraph();
    DirectedDFS dfs = new DirectedDFS();
    dfs.execute(graph1);
    dfs.isDone();
    Vertex v = graph1.aVertex();
    dfs.dfsVisit(v);

}

and this is the output I get:

vertex with element 0
vertex with element 2
vertex with element 1
the time is4
the time is5
the time is6
vertex with element 0
the time is8

Unfortunately when I call dfs.isDone(); it prints out a false so I can not see the depth first search result. I don't know which function I need to apply my DFS on my FSM

4

0 回答 0