Package junit.framework

Examples of junit.framework.TestResult


    public void execute(String testClassName) {
        TestDescriptorInternal testInternal = new DefaultTestClassDescriptor(idGenerator.generateId(), testClassName);
        resultProcessor.started(testInternal, new TestStartEvent(timeProvider.getCurrentTime()));

        Test adapter = createTest(testClassName);
        TestResult result = new TestResult();
        result.addListener(listener);
        adapter.run(result);

        resultProcessor.completed(testInternal.getId(), new TestCompleteEvent(timeProvider.getCurrentTime()));
    }
View Full Code Here


                final CartridgeTestFormatter formatter = new CartridgeTestFormatter();

                // - set the report location
                final File report = new File(this.reportDirectory, this.project.getArtifactId() + ".txt");
                formatter.setReportFile(report);
                final TestResult result = new TestResult();
                result.addListener(formatter);
                final Test suite = CartridgeTest.suite();
                formatter.startTestSuite(this.project.getName());
                suite.run(result);
                this.getLog().info("");
                this.getLog().info("Results:");
                this.getLog().info(formatter.endTestSuite(suite));
                cartridgeTest.shutdown();
                if (result.failureCount() > 0 || result.errorCount() > 0)
                {
                    throw new MojoExecutionException("Test are some test failures");
                }
            }
            catch (final Throwable throwable)
View Full Code Here

                final TranslationLibraryTestFormatter formatter = new TranslationLibraryTestFormatter();

                // - set the report location
                final File report = new File(this.reportDirectory, this.getProject().getArtifactId() + ".txt");
                formatter.setReportFile(report);
                final TestResult result = new TestResult();
                formatter.startTestSuite(this.getProject().getName());
                result.addListener(formatter);
                processor.setResult(result);
                processor.runSuite();
                this.getLog().info("");
                this.getLog().info("Results:");
                this.getLog().info(formatter.endTestSuite());
                if (result.failureCount() > 0 || result.errorCount() > 0)
                {
                    throw new MojoExecutionException("Test are some test failures");
                }
                processor.shutdown();
            }
View Full Code Here

                final TranslationLibraryTestFormatter formatter = new TranslationLibraryTestFormatter();

                // - set the report location
                final File report = new File(this.reportDirectory, this.getProject().getArtifactId() + ".txt");
                formatter.setReportFile(report);
                final TestResult result = new TestResult();
                formatter.startTestSuite(this.getProject().getName());
                result.addListener(formatter);
                processor.setResult(result);
                processor.runSuite();
                this.getLog().info("");
                this.getLog().info("Results:");
                this.getLog().info(formatter.endTestSuite());
                if (result.failureCount() > 0 || result.errorCount() > 0)
                {
                    throw new MojoExecutionException("Test are some test failures");
                }
                processor.shutdown();
            }
View Full Code Here

    asserterNode = vf.createBNode();
    con.add(asserterNode, RDF.TYPE, EARL.SOFTWARE);
    con.add(asserterNode, DC.TITLE, vf.createLiteral("OpenRDF SPARQL compliance test"));

    TestResult testResult = new TestResult();
    EarlTestListener listener = new EarlTestListener();
    testResult.addListener(listener);

    MemorySPARQLQueryTest.suite().run(testResult);
    SPARQLSyntaxTest.suite().run(testResult);

    con.commit();
View Full Code Here

    try
      {
         args = runner.preProcessCommandLine(args);

      TestResult r = runner.start(args);

      if (!r.wasSuccessful())
         {
        System.exit(FAILURE_EXIT);
         }
      System.exit(SUCCESS_EXIT);
    }
View Full Code Here

            testClass = val;
      }

      try
      {
         TestResult result = new TestResult();

         XMLJUnitResultFormatter resultFormatter = new XMLJUnitResultFormatter();

         JUnitTest dummyJUnit = new JUnitTest(name);
         resultFormatter.startTestSuite(dummyJUnit);

         OutputStream writer = new FileOutputStream(new File(reportFile));
         resultFormatter.setOutput(writer);

         result.addListener(resultFormatter);

         TestSuite suite = new TestSuite();

        
         JUnitClientTest test = null;
         try
         {
            test = (JUnitClientTest) Class.forName(testClass).newInstance();
         }
         catch (ClassCastException e)
         {
            System.err.println("Class " + testClass + " does not implement " + JUnitClientTest.class.getName());
         }
         catch (ClassNotFoundException e)
         {
            System.err.println("Cannot locate class " + testClass);
         }
         catch (IllegalAccessException e)
         {
            e.printStackTrace();
         }
         catch (InstantiationException e)
         {
            System.err.println("Class " + testClass + " cannot be instantiated: " + e.getMessage());
         }

         test.setName("testAction");
         test.init(config, params, isDebug);

         suite.addTest(test);

         long startTime = new Date().getTime();
         suite.run(result);
         long endTime = new Date().getTime();
        
         dummyJUnit.setCounts(result.runCount(), result.failureCount(), result.errorCount());
         dummyJUnit.setRunTime(endTime - startTime);
        
         resultFormatter.endTestSuite(dummyJUnit);

         writer.close();

         return result.wasSuccessful();
      }
      catch (Exception e)
      {
         if (isDebug)
            e.printStackTrace();
View Full Code Here

    // NestedTarTestCase.suite(),
    // NestedTgzTestCase.suite(),
    // NestedTbz2TestCase.suite(),
    };

    TestResult result = new TestResult()
    {
      public void startTest(Test test)
      {
        System.out.println("start " + test);
        System.out.flush();
View Full Code Here

        }
    }

    public void runWithResult() {

        TestResult result   = run();
        String     testName = this.getClass().getName();

        if (testName.startsWith("org.hsqldb.test.")) {
            testName = testName.substring(16);
        }

        testName += "." + getName();

        int failureCount = result.failureCount();

        System.out.println(testName + " failure count: " + failureCount);

        java.util.Enumeration failures = result.failures();

        while (failures.hasMoreElements()) {
            System.err.println(failures.nextElement());
        }
    }
View Full Code Here

    }

    /* Runs TestINPredicate test from the command line*/
    public static void main(String[] args) throws Exception {

        TestResult            result;
        TestCase              test;
        java.util.Enumeration failures;
        int                   count;

        result = new TestResult();
        test   = new TestINPredicateParameterizationAndCorrelation("test");

        test.run(result);

        count = result.failureCount();

        System.out.println(
            "TestINPredicateParameterizationAndCorrelation failure count: "
            + count);

        failures = result.failures();

        while (failures.hasMoreElements()) {
            System.out.println(failures.nextElement());
        }
    }
View Full Code Here

TOP

Related Classes of junit.framework.TestResult

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.