Examples of GreedyTester


Examples of nz.ac.waikato.modeljunit.GreedyTester

  public static void main(String[] args)
  {
    FsmModel model = new SimpleSet();
    List<Tester> testers = new ArrayList<Tester>();
    testers.add(new RandomTester(model));
    testers.add(new GreedyTester(model));
    testers.add(new LookaheadTester(model));

    for (Tester tester : testers) {
      double average = allTransitions(tester);
      System.out.println(tester.getName()+": "+average+" average.");
View Full Code Here

Examples of nz.ac.waikato.modeljunit.GreedyTester

        }
    }
   
    public void runModel(FSM model)
    {
      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);
     
      tester.printCoverage();
    }
View Full Code Here

Examples of nz.ac.waikato.modeljunit.GreedyTester

        + " New State: " + getState());
  }

  public static void main(String[] args)
  {
    Tester tester = new GreedyTester(new AlarmClockOld());
    System.out.println("------------------------");
    tester.setRandom(new Random());
    tester.generate(100);
    GraphListener listener = tester.buildGraph();
    try {
      listener.printGraphDot("OriginalAlarmClock.dot");
    }
    catch (FileNotFoundException e) {
      e.printStackTrace();
View Full Code Here

Examples of nz.ac.waikato.modeljunit.GreedyTester

  /** An example of generating tests from this model. */
  public static void main(String[] args)
  {
    Set<String> sut = new StringSetBuggy(); // StringSetBuggy();
    Tester tester = new GreedyTester(new SimpleSetWithAdaptor(sut));
    //tester.buildGraph(); // to get better statistics
    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

Examples of nz.ac.waikato.modeljunit.GreedyTester

   *  but we write it as main so that it is easy to run.
   */
  public static void main(String[] args)
  {
    Set<String> sut = new HashSet<String>();
    Tester tester = new GreedyTester(new SmartSetAdaptor(sut));
    tester.addListener("verbose");
    tester.generate(100);
  }
View Full Code Here

Examples of nz.ac.waikato.modeljunit.GreedyTester

      String line = input.readLine();
      if (line == null)
        break;
      if (line.equals("graph")) {
        quidonc.out.println("Building FSM graph...");
        Tester tester = new GreedyTester(quidonc);
        GraphListener graph = tester.buildGraph();
        graph.printGraphDot("QuiDonc.dot");
        quidonc.out.println("Printed FSM graph to QuiDonc.dot.");
        quidonc.out.println("Use dotty or dot from http://www.graphviz.org"
            + " to view/transform the graph.");
      }
View Full Code Here

Examples of nz.ac.waikato.modeljunit.GreedyTester

  }

  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

Examples of nz.ac.waikato.modeljunit.GreedyTester

  }

  public static void main(String[] args) throws FileNotFoundException
  {
    System.out.println("Exploring the SimCard model without testing the SUT.");
    RandomTester tester = new GreedyTester(new SimCard(null));
    // use very long test sequences (since reset corresponds to a new card).
    tester.setResetProbability(0.0001);
    GraphListener graph = tester.buildGraph(1000000);
    graph.printGraphDot("gsm.dot");
    System.out.println("Graph contains "
        + graph.getGraph().numVertices() + " states and "
        + graph.getGraph().numEdges() + " transitions.");
  }
View Full Code Here

Examples of nz.ac.waikato.modeljunit.GreedyTester


  /** An example of generating tests from this model. */
  public static void main(String[] args) throws IOException
  {
    Tester tester = new GreedyTester(new LargeSet(2));
    tester.buildGraph(100000);
    CoverageHistory hist = new CoverageHistory(new TransitionCoverage(), 1);
    tester.addCoverageMetric(hist);
    tester.addListener("verbose");
    while (hist.getPercentage() < 99.0)
      tester.generate();
    System.out.println("Transition Coverage ="+hist.toString());
    System.out.println("History = "+hist.toCSV());
  }
View Full Code Here

Examples of nz.ac.waikato.modeljunit.GreedyTester

        + " New State: " + getState());
  }

  public static void main(String[] args)
  {
    Tester tester = new GreedyTester(new AlarmClock());
    tester.setRandom(new Random());
    tester.generate(100);
    GraphListener listener = tester.buildGraph();
    try {
      listener.printGraphDot("AlarmClock.dot");
    }
    catch (FileNotFoundException e) {
      e.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.