Package nz.ac.waikato.modeljunit.coverage

Examples of nz.ac.waikato.modeljunit.coverage.TransitionCoverage


  protected CoverageMetric transitions;

  public void setUp()
  {
    tester = new LookaheadTester(new SimpleSet());
    transitions = tester.addCoverageMetric(new TransitionCoverage());
    path = new ArrayList<Transition>();
    tester.addListener(new AbstractListener() {
      private Object lastState = "";
      public String getName()
      {
View Full Code Here


   */
  public static double allTransitions(Tester tester)
  {
    GraphListener graph = tester.buildGraph(100000);
    //tester.addListener(new VerboseListener()); //if you want to see the tests
    CoverageMetric trans = tester.addCoverageMetric(new TransitionCoverage());
    int total = 0;
    tester.setRandom(new Random(Tester.FIXEDSEED));
    for (int run=0; run<RUNS; run++) {
      int steps = 0;
      trans.clear();
View Full Code Here

    GraphListener graph = tester.buildGraph();
    model.setTimeoutProbability(origProb);
    graph.printGraphDot("SimpleTimedLight.dot");
    System.out.println("FSM has " + graph.getGraph().numVertices() + " states and "
        + graph.getGraph().numEdges() + " transitions");
    CoverageMetric metric = tester.addCoverageMetric(new TransitionCoverage());
    for (double prob = 0.1; prob < 0.99; prob += 0.1) {
      model.setTimeoutProbability(prob);
      double totalSteps = 0.0;
      int totalTime = 0; // sum of all the totalTimes.
      for (int seed = 0; seed < experiments; seed++) {
View Full Code Here

      GreedyTester tester = new GreedyTester(model);
     
      tester.setRandom(new Random());
     
      tester.addCoverageMetric(new StateCoverage());
      tester.addCoverageMetric(new TransitionCoverage());
      tester.addCoverageMetric(new TransitionPairCoverage());
     
      tester.addListener(new StopOnFailureListener());
     
      tester.generate(10000);
View Full Code Here

  public void run()
  {
    for (int pass=0; pass < passes; pass++) {
      Model model = new Model(new QuiDonc());
      metric = new CoverageHistory(new TransitionCoverage(), 1);
      model.addListener(metric);
      int seed = rand.nextInt();

      seeds.add(seed);
View Full Code Here

    tester.addListener(new VerboseListener());
   
    // uncoment this line if you want to stop when the first error is found.
    // tester.addListener(new StopOnFailureListener());
   
    tester.addCoverageMetric(new TransitionCoverage());
    tester.generate(50);
    tester.printCoverage();
  }
View Full Code Here

   */
  public LookaheadTester(Model model)
  {
    super(model);
    model.addListener("graph");
    transitions_ = (CoverageMetric) model.addListener(new TransitionCoverage());
    actions_ = (CoverageMetric) model.addListener(new ActionCoverage());
    graph_ = (GraphListener) model.getListener("graph");
  }
View Full Code Here

   */
  public LookaheadTester(FsmModel fsm)
  {
    super(fsm);
    model_.addListener("graph");
    transitions_ = (CoverageMetric) model_.addListener(new TransitionCoverage());
    actions_ = (CoverageMetric) model_.addListener(new ActionCoverage());
    graph_ = (GraphListener) model_.getListener("graph");
  }
View Full Code Here

    Tester tester = new RandomTester(new ECinema());
    // The guards make this a more difficult graph to explore, but we can
    // increase the default maximum search to complete the exploration.
    GraphListener graph = tester.buildGraph(100000);
    graph.printGraphDot("ecinema.dot");
    CoverageMetric trans = tester.addCoverageMetric(new TransitionCoverage());
    CoverageMetric trpairs = tester.addCoverageMetric(new TransitionPairCoverage());
    CoverageMetric states = tester.addCoverageMetric(new StateCoverage());
    CoverageMetric actions = tester.addCoverageMetric(new ActionCoverage());
    tester.addListener("verbose");
    // this illustrates how to generate tests upto a given level of coverage.
View Full Code Here

  public void testSet() throws IOException
  {
    Set<String> sut = new StringSet();
    Tester tester = new GreedyTester(new SimpleSetWithAdaptor(sut));
    tester.addCoverageMetric(new TransitionCoverage());
    tester.addListener(new VerboseListener());
    tester.addListener(new StopOnFailureListener());
    tester.generate(60);
    tester.printCoverage(); // print the model coverage information
  }
View Full Code Here

TOP

Related Classes of nz.ac.waikato.modeljunit.coverage.TransitionCoverage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.