if (mTestDesign.isLineChartDrawable()) {
mCoverage.clearCoverages();
int[] stages = mCoverage.computeStages(mProject.getWalkLength());
mTestDesign.initializeTester(0);
Tester tester = TestExeModel.getTester(0);
/* tester.buildGraph();*/
// Leave the coverage window hidden until manually opened from the View menu
// displayCoverageWindow();
buildGraphGUI();
CoverageHistory[] coverage = new CoverageHistory[TestExeModel.COVERAGE_NUM];
coverage[0] = new CoverageHistory(new StateCoverage(), 1);
coverage[1] = new CoverageHistory(new TransitionCoverage(), 1);
coverage[2] = new CoverageHistory(new TransitionPairCoverage(), 1);
coverage[3] = new CoverageHistory(new ActionCoverage(), 1);
tester.addCoverageMetric(coverage[0]);
tester.addCoverageMetric(coverage[1]);
tester.addCoverageMetric(coverage[2]);
tester.addCoverageMetric(coverage[3]);
// Run test several times to draw line chart
for (int i = 0; i < stages.length; i++) {
tester.generate(stages[0]);
//System.out.println("DEBUG: Progress: " + stages[i] + "/" + mProject.getWalkLength());
mCoverage.setProgress(stages[i], mProject.getWalkLength());
// Update the line chart and repaint
mCoverage.addStateCoverage((int) coverage[0].getPercentage());
mCoverage.addTransitionCoverage((int) coverage[1].getPercentage());
mCoverage.addTransitionPairCoverage((int) coverage[2].getPercentage());
mCoverage.addActionCoverage((int) coverage[3].getPercentage());
mCoverage.redrawGraph();
}
}
// To reset tester, it solve the problem that coverage matrix incorrect.
mTestDesign.initializeTester(0);
//reset the visualisation panel
mVisualisation.resetRunTimeInformation();
//Try to fully explore the complete graph before running the test explorations
Tester tester = TestExeModel.getTester(0);
GraphListener graph = tester.buildGraph();
mVisualisation.showEmptyExploredGraph(graph);
// Clear the information in Result viewer text area
mResultViewer.resetRunTimeInformation();