Package junit.framework

Examples of junit.framework.TestListener


       }

       public void run(final TestResult result)
       {
           TestResult subResult = new TestResult();
           subResult.addListener(new TestListener()
           {
               public void addError(Test subtest, Throwable throwable)
               {
                   Test dummyTest = createDummyTest(subtest);
                   result.addError(dummyTest, throwable);
View Full Code Here


                _passedTests.clear();
                _failedTests.clear();
                _errorTests.clear();

                Class        testSuiteClass = Class.forName(_testSuiteClassName);
                TestListener testListener   = new BasicTestListener();

                _testResult = new TestResult();
                _testSuite  = (TestSuite) testSuiteClass.newInstance();

                _testResult.addListener(testListener);
View Full Code Here

        }
        TestResult result = getResult();
        if ( result == null ) {
            result = createResult(output);
        }
        TestListener listener = getListener();
        if ( listener == null ) {
            listener = createTestListener(output);
        }
        result.addListener(listener);
        test.run(result);
View Full Code Here

    /**
     * Factory method to create a new TestListener to capture the output of
     * the test cases
     */
    protected TestListener createTestListener(final XMLOutput output) {
        return new TestListener() {
            public void addError(Test test, Throwable t) {
                try {
                    output.startElement("error");

                    output.startElement("message");
View Full Code Here

       }

       public void run(final TestResult result)
       {
           TestResult subResult = new TestResult();
           subResult.addListener(new TestListener()
           {
               public void addError(Test subtest, Throwable throwable)
               {
                   Test dummyTest = createDummyTest(subtest);
                   result.addError(dummyTest, throwable);
View Full Code Here

                _passedTests.clear();
                _failedTests.clear();
                _errorTests.clear();

                Class        testSuiteClass = Class.forName(_testSuiteClassName);
                TestListener testListener   = new BasicTestListener();

                _testResult = new TestResult();
                _testSuite  = (TestSuite) testSuiteClass.newInstance();

                _testResult.addListener(testListener);
View Full Code Here

      parentSuite = new Suite(getClass().getName());
      initializedSuites.put(getClass().getName(), parentSuite);
      System.out.println("setUpSuite() in " + getClass().getName());
      // TODO (alex) tearDownSuite() not executed
      final AtomicBoolean errors = new AtomicBoolean();
      final TestListener listener = new TestListener() {
        public void startTest(Test test) {
        }

        public void endTest(Test test) {
        }
View Full Code Here

  public void addFailureDelegatesToNotifier() {
    Result result= new Result();
    RunListener listener= result.createListener();
    RunNotifier notifier= new RunNotifier();
    notifier.addFirstListener(listener);
    TestListener adaptingListener= JUnit38ClassRunner
        .createAdaptingListener(notifier);
    TestCase testCase= new TestCase() {
    };
    adaptingListener.addFailure(testCase, new AssertionFailedError());
    assertEquals(1, result.getFailureCount());
  }
View Full Code Here

     * as a failure not an error.
     *
     * @since Ant 1.7
     */
    private TestListener wrapListener(final TestListener testListener) {
        return new TestListener() {
            public void addError(Test test, Throwable t) {
                if (junit4 && t instanceof AssertionFailedError) {
                    // JUnit 4 does not distinguish between errors and failures
                    // even in the JUnit 3 adapter.
                    // So we need to help it a bit to retain compatibility for JUnit 3 tests.
View Full Code Here

 
  public void testNotifyResult() {
    JUnit4TestAdapter adapter= new JUnit4TestAdapter(ErrorTest.class);
    TestResult result= new TestResult();
    final StringBuffer log= new StringBuffer();
    result.addListener(new TestListener() {
   
      public void startTest(junit.framework.Test test) {
        log.append(" start " + test);
      }
   
View Full Code Here

TOP

Related Classes of junit.framework.TestListener

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.