Package nz.ac.waikato.modeljunit.coverage

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


    model.addListener("graph");
    assertTrue(model.getListener("graph") instanceof GraphListener);
    assertEquals(model.getGraphListener(), model.getListener("graph"));
    assertEquals(1, model.getListenerNames().size());
    assertEquals(model.getGraphListener(), new RandomTester(model).buildGraph());
    model.addListener(new TransitionCoverage());
    TransitionCoverage tr = (TransitionCoverage) model.getListener("transition coverage");
    assertEquals(2, model.getListenerNames().size());
    assertEquals(5, tr.getMaximum()); // it should have been given the graph
    assertEquals("0/5", tr.toString());
    model.removeAllListeners();
    assertEquals(0, model.getListenerNames().size());
  }
View Full Code Here


  /** This tests a random walk, plus transition coverage */
  public static void testRandomWalk()
  {
    output_.write("STARTING RANDOM\n");
    Tester tester = new RandomTester(quidonc);
    CoverageHistory metric = new CoverageHistory(new TransitionCoverage(), 1);
    tester.addListener(metric);
    tester.generate(100);
    int coverage = metric.getCoverage();
    List<Integer> hist = metric.getHistory();
    Assert.assertNotNull(hist);
View Full Code Here

  /** This tests a greedy random walk, plus transition coverage */
  public static void testGreedyRandomWalk()
  {
    output_.write("STARTING GREEDY\n");
    Tester tester = new GreedyTester(new QuiDonc());
    CoverageHistory metric = new CoverageHistory(new TransitionCoverage(), 1);
    tester.addListener(metric);
    tester.generate(100);
    int coverage = metric.getCoverage();
    List<Integer> hist = metric.getHistory();
    Assert.assertNotNull(hist);
View Full Code Here

  /** This tests an all-round-trips walk, plus transition coverage */
  public static void testAllRoundTrips()
  {
    output_.write("STARTING ALL ROUND TRIPS\n");
    Tester tester = new AllRoundTester(new QuiDonc());
    CoverageHistory metric = new CoverageHistory(new TransitionCoverage(), 1);
    tester.addCoverageMetric(metric);
    tester.generate(100);
    int coverage = metric.getCoverage();
    List<Integer> hist = metric.getHistory();
    Assert.assertNotNull(hist);
View Full Code Here

  /** This tests a greedy random walk, plus TransitionCoverage metric with history */
  public static void testGreedyRandomWalk()
  {
    ModelTestCase model = new ModelTestCase(new FSM());
    CoverageHistory metric = new CoverageHistory(new TransitionCoverage(), 1);
    model.addCoverageMetric(metric);
    model.greedyRandomWalk(7); // 7 transitions plus a few resets
    int coverage = metric.getCoverage();
    Assert.assertEquals(5, coverage);
    Assert.assertEquals(-1, metric.getMaximum());
View Full Code Here

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

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

  public static void testResetHigh()
  {
    RandomTester tester = new RandomTester(new FSM());
    tester.buildGraph();
    tester.setResetProbability(0.9);
    CoverageMetric trCover = new TransitionCoverage();
    CoverageHistory hist = new CoverageHistory(trCover,1);
    tester.addListener(hist);
    tester.generate(40);
    // the random walk should choose reset almost all the time
    // so should not get much past the first transition.
    Assert.assertEquals(41, hist.getHistory().size());
    Assert.assertEquals(1, trCover.getCoverage());
  }
View Full Code Here

{
  /** This tests a random walk, plus TransitionCoverage metric with history.*/
  public static void testAllRoundWalk()
  {
    AllRoundTester tester = new AllRoundTester(new FSM());
    CoverageHistory metric = new CoverageHistory(new TransitionCoverage(), 1);
    //tester.addListener(new VerboseListener());
    tester.addCoverageMetric(metric);
    tester.setLoopTolerance(1);
    tester.setRandom(new Random(3));
    tester.generate(10);
View Full Code Here

  protected CoverageMetric transitions;

  @Before
  public void setUp()   {
    tester = new QuickTester(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

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.