Contents

61B-7: Testing

Contents

Ad Hoc Testing vs. JUnit

/61b-7/image.png

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
public class TestSort {
  /** Tests the sort method of the Sort class. */  
  public static testSort() {
    String[] input = {"cows", "dwell", "above", "clouds"};
    String[] expected = {"above", "cows", "clouds", "dwell"};
    Sort.sort(input);
 
    org.junit.Assert.assertArrayEquals(expected, input);
  }
 
  public static void main(String[] args) {
    testSort();
  }
}

Selection Sort

简单介绍一下了,关注点在junit /61b-7/image-1.png

Simpler JUnit Tests

/61b-7/image-2.png /61b-7/image-3.png /61b-7/image-4.png

ADD, TDD, Integration Testing

/61b-7/image-5.png

More On JUnit (Extra)

/61b-7/image-6.png /61b-7/image-7.png