Package nz.ac.waikato.modeljunit.coverage

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


  /** This tests a random walk, plus ActionCoverage metric with history.*/
  public static void testRandomWalk()
  {
    ModelTestCase model = new ModelTestCase(new FSM());
    CoverageHistory metric = new CoverageHistory(new ActionCoverage(), 1);
    model.addCoverageMetric(metric);
    model.randomWalk(4); // 4 transitions plus a few resets
    int coverage = metric.getCoverage();
    Assert.assertEquals(3, coverage);
    Assert.assertEquals(-1, metric.getMaximum()); // unknown.
View Full Code Here


   *  It may need adjusting when the seed or random walk algorithm changes.
   */
  public void testActionCoverage()
  {
    //    System.out.println("Starting testActionCoverage");
    FsmCoverage(new ActionCoverage(), 4,
        new int[] {1,1, 3,3, 20,4});
  }
View Full Code Here

    //System.out.println("action0="+tester.getModel().getActionName(0));
    //System.out.println("action1="+tester.getModel().getActionName(1));
    //System.out.println("action2="+tester.getModel().getActionName(2));
    //System.out.println("action3="+tester.getModel().getActionName(3));
    CoverageHistory metric =
      new CoverageHistory(new ActionCoverage(), 1);
    tester.addListener(metric);
   
    Random random = new Random(3);
    tester.setRandom(random);
    tester.generate(5);
View Full Code Here

   *  It may need adjusting when the seed or random walk algorithm changes.
   */
  public void testActionCoverage()
  {
    //    System.out.println("Starting testActionCoverage");
    FsmCoverage(new ActionCoverage(), 4,
        new int[] {1,1, 3,3, 20,4});
  }
View Full Code Here

 
  public void testPrintCoverage()
  {
    RandomTester tester = new RandomTester(new FSM());
    tester.addListener("transition coverage");
    tester.addCoverageMetric(new ActionCoverage());
    tester.buildGraph();
    tester.generate(100);
    StringWriter out = new StringWriter();
    tester.getModel().setOutput(out);
    tester.printCoverage();
View Full Code Here

  public static void testGreedyWalk()
  {
    Tester tester = new GreedyTester(new FSM());
    tester.addListener(new VerboseListener());
    CoverageHistory metric =
      new CoverageHistory(new ActionCoverage(), 1);
    tester.addCoverageMetric(metric);
    tester.setRandom(new Random(1));
    tester.generate(7);
    int coverage = metric.getCoverage();
    Assert.assertEquals(4, coverage);
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

    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.
    int steps = 0;
    while (actions.getPercentage() < 100 /* || steps < 1000*/) {
      tester.generate();
View Full Code Here

        if (bCoverage[2]) {
            coverage[2] = new TransitionPairCoverage();
            m_tester[0].addCoverageMetric(coverage[2]);
        }
        if (bCoverage[3]) {
            coverage[3] = new ActionCoverage();
            m_tester[0].addCoverageMetric(coverage[3]);
        }

        StringBuffer verbose = new StringBuffer();
        StringWriter sw = new StringWriter();
View Full Code Here

TOP

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

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.