Package bm.javautil

Class RunJunit4

java.lang.Object
bm.javautil.RunJunit4

public final class RunJunit4 extends Object
Provides a way to run Junit4 on a list of classes with logging to blend in with other BuildMachine logging.
  • Method Details

    • main

      public static void main(String[] argv) throws Exception
      Runs Junit on classes if their fully qualified name contains a match of a regex given on the command line. If the regex is followed by "#method1,method2,..." only the given listed methods are run in matching classes. While ".#specificTest" is possible, it will create a warning for all classes which do not contain specificTest.

      Test failures are logged with a single line to System.err, which is to be expected to come out in the console together with other BuildMachine logging. A full failure log is written to System.out with the intention of being captured into a file for closer inspection.

      Finally, a summary line is logged with failed, run and ignored test counts.

      Example
      java ... bm.RunJunit4 path/to/testclasses SomeTest OtherTest#someMethod,otherMethod
      Parameters:
      argv - with argv[0] a classpath like string, i.e. separated by File.pathSeparator where we look for class names to match. All other arguments have the form classnameRe[#m[,m...]] as described above.
      Throws:
      Exception