Package com.dotcms.repackage.org.junit.runner

Examples of com.dotcms.repackage.org.junit.runner.JUnitCore


     * @throws IOException
     */
    private void xmlReport ( HttpServletResponse response, String className ) throws ServletException, IOException {

        //Running the given junit test class
        JUnitCore jUnitCore = new JUnitCore();

        //Preparing the reports folder
        String logsDirectory = Config.CONTEXT.getRealPath( "dotsecure" ) + File.separator + "logs" + File.separator + "test" + File.separator;
        File reportDirectory = new File( logsDirectory );
        FileUtils.deleteDirectory( reportDirectory );
        reportDirectory.mkdirs();

        Logger.info( "Generating XML report in " + reportDirectory.getAbsolutePath() );

        //Adding a listener for the running test
        TestXmlRingingListener testXmlRingingListener = new TestXmlRingingListener( reportDirectory );
        jUnitCore.addListener( testXmlRingingListener );

        try {
            Class clazz = Class.forName( className );
            testXmlRingingListener.startFile( clazz );
            jUnitCore.run( clazz );
            testXmlRingingListener.closeFile();
        } catch ( ClassNotFoundException e ) {
            throw new ServletException( e );
        }

View Full Code Here


    private void plainTextReport ( HttpServletResponse response, String className ) throws ServletException, IOException {

        response.setContentType( "text/plain" );

        //Running the given junit test class
        JUnitCore jUnitCore = new JUnitCore();
        //Adding a listener for the running test
        TestTextRingingListener testRingingListener = new TestTextRingingListener();
        jUnitCore.addListener( testRingingListener );
        try {
            jUnitCore.run( Class.forName( className ) );
        } catch ( ClassNotFoundException e ) {
            throw new ServletException( e );
        }

        //Setting the response
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.junit.runner.JUnitCore

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.