Package org.junit.runner

Examples of org.junit.runner.JUnitCore.addListener()


import org.junit.runner.JUnitCore;

public class TestSuite {
    public static void main(String[] args) {
        JUnitCore runner = new JUnitCore();
        runner.addListener(new TextListener(System.out));
        runner.run(FeatureTest.class);
    }
}
View Full Code Here


    private static JUnitCore createJUnitCore( List<RunListener> listeners )
    {
        JUnitCore junitCore = new JUnitCore();
        for ( RunListener runListener : listeners )
        {
            junitCore.addListener( runListener );
        }
        return junitCore;
    }

    private static void executeEager(TestsToRun testsToRun, Filter filter, Computer computer, JUnitCore junitCore)
View Full Code Here

    @Test
    public void constructor_is_called_for_each_test_in_test_class() throws Exception {
        // given
        JUnitCore jUnitCore = new JUnitCore();
        jUnitCore.addListener(new TextListener(System.out));

        // when
        jUnitCore.run(junit_test_with_3_tests_methods.class);

        // then
View Full Code Here

public class MockitoRunnerBreaksWhenNoTestMethodsTest extends TestBase {

    @Test
    public void ensure_the_test_runner_breaks() throws Exception {
        JUnitCore runner = new JUnitCore();
        runner.addListener(new TextListener(System.out));

        Result result = runner.run(TestClassWithoutTestMethod.class);

        assertEquals(1, result.getFailureCount());
        assertFalse(result.wasSuccessful());
View Full Code Here

public class Test {

  public static void main(String[] args) {
    JUnitCore core = new JUnitCore();
    core.addListener(new TextListener());
    core.run(TestSuite.class);
  }

}
View Full Code Here

    return "test";
  }

  public void run(String[] args) {
        JUnitCore core = new JUnitCore();
        core.addListener(new TextListener());
        core.run(TestCommand.class);
  }

}
View Full Code Here

    helpFormatter.printHelp("segment", options);
  }
 
  private void test() {
        JUnitCore core = new JUnitCore();
        core.addListener(new TextListener());
        core.run(SegmentTestSuite.class);
  }
 
  private void segment(CommandLine commandLine) throws IOException {
View Full Code Here

      ExpectedExceptionHolder exceptionHolder = new ExpectedExceptionHolder();
      try
      {
          JUnitCore runner = new JUnitCore();

          runner.addListener(exceptionHolder);

          for (RunListener listener : getRunListeners())
             runner.addListener(listener);

          Result result = runner.run(Request.method(testClass, methodName));
View Full Code Here

          JUnitCore runner = new JUnitCore();

          runner.addListener(exceptionHolder);

          for (RunListener listener : getRunListeners())
             runner.addListener(listener);

          Result result = runner.run(Request.method(testClass, methodName));

          if (result.getFailureCount() > 0)
          {
View Full Code Here

      LuceneTestCase.ignoreAfterMaxFailures.maxFailures = 2;
      LuceneTestCase.ignoreAfterMaxFailures.failuresSoFar = 0;

      JUnitCore core = new JUnitCore();
      final StringBuilder results = new StringBuilder();
      core.addListener(new RunListener() {
        char lastTest;

        @Override
        public void testStarted(Description description) throws Exception {
          lastTest = 'S'; // success.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.