Package junit.textui

Examples of junit.textui.TestRunner


     * This is a quick and dirty program to run the MdcInjectionFilterTest many times.
     * To be removed once we consider DIRMINA-784 to be fixed
     *
     */
    public static void main(String[] args) {
        TestRunner runner = new TestRunner();

        try {
            for (int i=0; i<50000; i++) {
                Test test = new JUnit4TestAdapter(MdcInjectionFilterTest.class);
                runner.doRun(test);
                System.out.println("i = " + i + " " + new Date());
            }
            System.out.println("done");
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here


public class LoopTestJMagick {

  public static void main(String[] args) throws Throwable {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(TestJMagick.class);
    TestRunner aTestRunner = new TestRunner();

    TestJMagick.popupWindow = false;
    MagickTesttools.dont_compare_output = true;

View Full Code Here

     * This is a quick and dirty program to run the MdcInjectionFilterTest many times.
     * To be removed once we consider DIRMINA-784 to be fixed
     *
     */
    public static void main(String[] args) {
        TestRunner runner = new TestRunner();

        try {
            for (int i=0; i<50000; i++) {
                Test test = new JUnit4TestAdapter(MdcInjectionFilterTest.class);
                runner.doRun(test);
                System.out.println("i = " + i + " " + new Date());
            }
            System.out.println("done");
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

            fail("Shouldn't get here.");
        }
    }

    public void testSingle() throws Exception {
        TestRunner t = new TestRunner();
        t.setPrinter(new ResultPrinter(new PrintStream(new ByteArrayOutputStream())));
        String[] args = {
                "-m", "junit.tests.runner.TextRunnerSingleMethodTest$InvocationTest.testWasInvoked"
        };
        fgWasInvoked = false;
        t.start(args);
        assertTrue(fgWasInvoked);
    }
View Full Code Here

    }

    @Override
    public void setUp() {
        output = new ByteArrayOutputStream();
        runner = new TestRunner(new TestResultPrinter(new PrintStream(output)));
    }
View Full Code Here

        }
    }

    public void testError() {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        TestRunner runner = new TestRunner(new TestResultPrinter(
                new PrintStream(output)));

        String expected = expected(new String[]{".E", "Time: 0",
                "Errors here", "", "FAILURES!!!",
                "Tests run: 1,  Failures: 0,  Errors: 1", ""});
        ResultPrinter printer = new TestResultPrinter(new PrintStream(output)) {
            @Override
            public void printErrors(TestResult result) {
                getWriter().println("Errors here");
            }
        };
        runner.setPrinter(printer);
        TestSuite suite = new TestSuite();
        suite.addTest(new TestCase() {
            @Override
            public void runTest() throws Exception {
                throw new Exception();
            }
        });
        runner.doRun(suite);
        assertEquals(expected, output.toString());
    }
View Full Code Here

        }
    }

    public void testErrorAdapted() {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        TestRunner runner = new TestRunner(new TestResultPrinter(
                new PrintStream(output)));

        String expected = expected(new String[]{".E", "Time: 0",
                "Errors here", "", "FAILURES!!!",
                "Tests run: 1,  Failures: 0,  Errors: 1", ""});
        ResultPrinter printer = new TestResultPrinter(new PrintStream(output)) {
            @Override
            public void printErrors(TestResult result) {
                getWriter().println("Errors here");
            }
        };
        runner.setPrinter(printer);
        runner.doRun(new JUnit4TestAdapter(ATest.class));
        assertEquals(expected, output.toString());
    }
View Full Code Here

  }
 
  @Override
  public void setUp() {
    output= new ByteArrayOutputStream();
    runner= new TestRunner(new TestResultPrinter(new PrintStream(output)));
  }
View Full Code Here

      fail("Shouldn't get here.");
    }
  }
 
  public void testSingle() throws Exception {
    TestRunner t= new TestRunner();
    t.setPrinter(new ResultPrinter(new PrintStream(new ByteArrayOutputStream())));
    String[] args= {
        "-m", "junit.tests.runner.TextRunnerSingleMethodTest$InvocationTest.testWasInvoked"
    };
    fgWasInvoked= false;
    t.start(args);
    assertTrue(fgWasInvoked);
  }
View Full Code Here

    }
  }

  public void testError() {
    ByteArrayOutputStream output= new ByteArrayOutputStream();
    TestRunner runner= new TestRunner(new TestResultPrinter(
        new PrintStream(output)));

    String expected= expected(new String[] { ".E", "Time: 0",
        "Errors here", "", "FAILURES!!!",
        "Tests run: 1,  Failures: 0,  Errors: 1", "" });
    ResultPrinter printer= new TestResultPrinter(new PrintStream(output)) {
      @Override
      public void printErrors(TestResult result) {
        getWriter().println("Errors here");
      }
    };
    runner.setPrinter(printer);
    TestSuite suite= new TestSuite();
    suite.addTest(new TestCase() {
      @Override
      public void runTest() throws Exception {
        throw new Exception();
      }
    });
    runner.doRun(suite);
    assertEquals(expected, output.toString());
  }
View Full Code Here

TOP

Related Classes of junit.textui.TestRunner

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.