Class CrossTester

java.lang.Object
com.spertus.jacquard.crosstester.CrossTester

public class CrossTester extends Object
A grader for running student-provided tests against multiple implementations. This can be used to test whether student tests fail intentionally buggy code (which is good) or pass correct code (also good).
  • Constructor Details

    • CrossTester

      public CrossTester(Class<?> testClass, String csvFileName)
      Creates a cross tester that uses the provided test class to instantiate classes under test that are specified in a CSV file.

      The file should contain the packages under test (in the header row), the methods under test (in the leftmost column), and maximum points for each combination. A positive points value means that points should be scored if the test passes, a negative points value means that points should be scored if the test fails, while a points value of zero means that no points should be scored for the combination. If a points value is non-zero and there are no tests of the specified method, a score of 0 is given.

      Consider this sample file, which might be used to check whether student tests do not report bugs on instructor-provided correct code but do report bugs (fail) on instructor-provided code that has a deliberate but in the `add()` method:

               , correct, buggy
            add,     2.5,  -5
           size,     1.5,   0
       
      The test class would be instantiated first with the package "correct". If all tests whose names begin with "add" pass, the result would be 2.5/2.5 points. If any tests beginning with "add" failed or if there were none, the result would be 0/2.5. The results would be similar (except for maxing out at 1.5) for tests starting with "size".

      Next, the test class would be instantiated with the package "buggy". If any test whose name begins with "add" _fails_, the result would be 5/5. If all tests beginning with "add" passed or if there were none, the result would be 0/5. No results would be produced for test methods with names beginning with "size".

      Parameters:
      testClass - the class containing the tests
      csvFileName - the name of the CSV file, which must be in a resource directory
  • Method Details