mil.dod.th.junit4.test.runner/src/mil/dod/th/ose/junit4xmltestrunner/XMLTestRunner.java
public static void run(final File dir, final String suffix, final boolean printStackTrace, 
            final Class<?>... classes) throws IOException
    {
        for (Class<?> klass : classes)
        {
            final JUnitCore core = new JUnitCore();
            final XMLJUnitResultFormatter formatter = new XMLJUnitResultFormatter();
            
            final String qualifiedClassName = String.format("%s-%s", klass.getName(), suffix);
            final File reportFile = new File(dir, "TEST-" + qualifiedClassName + ".xml");
            final OutputStream outStream = new FileOutputStream(reportFile);
            formatter.setOutput(outStream);
            
            core.addListener(new XMLFormatterListener(formatter, printStackTrace));
            
            final Result results;
            try
            {
                formatter.startTestSuite(qualifiedClassName);
                results = core.run(klass);
                formatter.endTestSuite(results);
            }
            finally
            {
                formatter.cleanup();
            }
            
            logMemoryUsage();
        }
    }
/**
     * Run the given test classes using the runner.  A separate XML file will be generated for each class.
     * 
     * @param dir
     *      Base directory to place the XML reports
     * @param suffix
     *      String to append to class name to differentiate from other times the class is executed
     * @param printStackTrace
     *      whether to print stack trace on failures
     * @param classes
     *      All the classes to run, a class must be decorated with the @Test annotation
     * @throws IOException
     *      Error writing to file or creating a file
     */
Run the given test classes using the runner.  A separate XML file will be generated for each class.


Run the given test classes using the runner . A separate XML file will be generated for each class .
public static void run(final File dir, final String suffix, final boolean printStackTrace, 
            final Class<?>... classes) throws IOException
    {
        for (Class<?> klass : classes)
        {
            final JUnitCore core = new JUnitCore();
            final XMLJUnitResultFormatter formatter = new XMLJUnitResultFormatter();
            final String qualifiedClassName = String.format("%s-%s", klass.getName(), suffix);
            final File reportFile = new File(dir, "TEST-" + qualifiedClassName + ".xml");
            final OutputStream outStream = new FileOutputStream(reportFile);
            formatter.setOutput(outStream);
            core.addListener(new XMLFormatterListener(formatter, printStackTrace));
            final Result results;
            try
            {
                formatter.startTestSuite(qualifiedClassName);
                results = core.run(klass);
                formatter.endTestSuite(results);
            }
            finally
            {
                formatter.cleanup();
            }
            logMemoryUsage();
        }
    }
public static void run ( final File dir , final String suffix , final boolean printStackTrace , final Class < ? > ... classes ) throws IOException { for ( Class < ? > klass : classes ) { final JUnitCore core = new JUnitCore ( ) ; final XMLJUnitResultFormatter formatter = new XMLJUnitResultFormatter ( ) ; final String qualifiedClassName = String . format ( "%s-%s" , klass . getName ( ) , suffix ) ; final File reportFile = new File ( dir , "TEST-" + qualifiedClassName + ".xml" ) ; final OutputStream outStream = new FileOutputStream ( reportFile ) ; formatter . setOutput ( outStream ) ; core . addListener ( new XMLFormatterListener ( formatter , printStackTrace ) ) ; final Result results ; try { formatter . startTestSuite ( qualifiedClassName ) ; results = core . run ( klass ) ; formatter . endTestSuite ( results ) ; } finally { formatter . cleanup ( ) ; } logMemoryUsage ( ) ; } }
Run the given test classes using the runner.
Run the given test classes using the runner .