當前位置: 首頁>>代碼示例>>Java>>正文


Java TextListener類代碼示例

本文整理匯總了Java中org.junit.internal.TextListener的典型用法代碼示例。如果您正苦於以下問題:Java TextListener類的具體用法?Java TextListener怎麽用?Java TextListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TextListener類屬於org.junit.internal包,在下文中一共展示了TextListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doRun

import org.junit.internal.TextListener; //導入依賴的package包/類
public Result doRun(Test suite, boolean wait) {
    MarathonTestRunner runner = new MarathonTestRunner();
    runReportDir = argProcessor.getReportDir();
    String resultsDir = new File(runReportDir, "results").getAbsolutePath();
    if (runReportDir != null) {
        System.setProperty(Constants.PROP_REPORT_DIR, runReportDir);
        System.setProperty(Constants.PROP_IMAGE_CAPTURE_DIR, runReportDir);
        System.setProperty("allure.results.directory", resultsDir);
        runner.addListener(new AllureMarathonRunListener());
    }
    runner.addListener(new TextListener(System.out));
    Result result = runSuite(suite, runner);
    MarathonTestCase.reset();
    if (runReportDir != null && !argProcessor.isSkipreports()) {
        AllureUtils.launchAllure(false, resultsDir, new File(runReportDir, "reports").getAbsolutePath());
    }
    return result;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:TestRunner.java

示例2: runTests

import org.junit.internal.TextListener; //導入依賴的package包/類
public void runTests(String outputDir) {
    JUnitCore junit = new JUnitCore();
    if (outputDir == null) {
        junit.addListener(new TextListener(System.out));
    } else {
        junit.addListener(new JUnitResultFormatterAsRunListener(new XMLJUnitResultFormatter()) {
            @Override
            public void testStarted(Description description) throws Exception {
                formatter.setOutput(new FileOutputStream(
                        new File(outputDir, "TEST-" + description.getDisplayName() + ".xml")));
                super.testStarted(description);
            }
        });
    }
    junit.run(TestContainer.class);
}
 
開發者ID:cmu-db,項目名稱:peloton-test,代碼行數:17,代碼來源:JUnitRunner.java

示例3: testSystem

import org.junit.internal.TextListener; //導入依賴的package包/類
@Test
public void testSystem() throws Throwable {
    Computer computer = new Computer();
    JUnitCore jUnitCore = new JUnitCore();

    ByteArrayOutputStream capture = new ByteArrayOutputStream();
    final PrintStream printStream = new PrintStream(capture);
    TextListener listener = new TextListener(printStream);
    jUnitCore.addListener(listener);

    PrintStream systemOut = System.out;
    System.setOut(printStream);
    try {
        jUnitCore.run(computer, ExampleTest.class);
    } finally {
        System.setOut(systemOut);
    }

    String output = capture.toString("UTF-8");
    output = normalizeOutput(output);

    String expectedOutput = getResource("/CompositeTest.testSystem.expected.txt");
    Assert.assertEquals(expectedOutput, output);
}
 
開發者ID:diosmosis,項目名稱:junit-composite-runner,代碼行數:25,代碼來源:CompositeRunnerTest.java

示例4: addListeners

import org.junit.internal.TextListener; //導入依賴的package包/類
private void addListeners(List<RunListener> listeners, JUnitCore testRunner,
                          PrintStream writer) {
    if (getBooleanArgument(ARGUMENT_SUITE_ASSIGNMENT)) {
        listeners.add(new SuiteAssignmentPrinter());
    } else {
        listeners.add(new TextListener(writer));
        listeners.add(new LogRunListener());
        mInstrumentationResultPrinter = new InstrumentationResultPrinter();
        listeners.add(mInstrumentationResultPrinter);
        listeners.add(new ActivityFinisherRunListener(this,
                new ActivityFinisher()));
        addDelayListener(listeners);
        addCoverageListener(listeners);
    }

    addListenersFromArg(listeners, writer);
    addListenersFromManifest(listeners, writer);

    for (RunListener listener : listeners) {
        testRunner.addListener(listener);
        if (listener instanceof InstrumentationRunListener) {
            ((InstrumentationRunListener) listener).setInstrumentation(this);
        }
    }
}
 
開發者ID:mg6maciej,項目名稱:android-groovy-dagger-espresso-demo,代碼行數:26,代碼來源:AndroidSpockRunner.java

示例5: main

import org.junit.internal.TextListener; //導入依賴的package包/類
/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		JUnitCore junit = new JUnitCore();
	    junit.addListener(new TextListener(System.out));
	    junit.run(
//	    	LearnerTest.class,
			AtomTest.class,
			ClauseTest.class,
			ConfigTest.class,
			GAtomTest.class,
			GClauseTest.class,
			GroundingTest.class,
			InferenceTest.class,
			LiteralTest.class,
			ParsingLoadingTest.class,
			PredicateTest.class,
			TermTest.class,
			TupleTest.class,
			TypeTest.class
		);

	}
 
開發者ID:allenai,項目名稱:tuffylite,代碼行數:26,代碼來源:runAllTestCases.java

示例6: getExpectedOutput

import org.junit.internal.TextListener; //導入依賴的package包/類
private ByteArrayOutputStream getExpectedOutput(Class<?> testClass) {
  JUnitCore core = new JUnitCore();

  ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
  PrintStream printStream = new PrintStream(byteStream);
  printStream.println("JUnit4 Test Runner");
  RunListener listener = new TextListener(printStream);
  core.addListener(listener);

  Request request = Request.classWithoutSuiteMethod(testClass);

  core.run(request);
  printStream.close();

  return byteStream;
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:17,代碼來源:JUnit4RunnerTest.java

示例7: run

import org.junit.internal.TextListener; //導入依賴的package包/類
/**
 * A method to allow tests to be run from simple scripts without all the JUnit infrastructure
 *
 * @return The number of failed tests
 */
public int run() {
    JoranConfigurator configurator = new JoranConfigurator();
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    try {
        configurator.setContext(context);
        context.reset();
        configurator.doConfigure(classpath("/logback-morc.xml"));
    } catch (JoranException e) {
        throw new RuntimeException(e);
    }

    JUnitCore core = new JUnitCore();
    core.addListener(new TextListener(System.out));
    try {
        Result r = core.run(new MorcParameterized(this));
        return r.getFailureCount();
    } catch (Throwable t) {
        throw new RuntimeException(t);
    }
}
 
開發者ID:uoa-group-applications,項目名稱:morc,代碼行數:26,代碼來源:MorcTestBuilder.java

示例8: doWork

import org.junit.internal.TextListener; //導入依賴的package包/類
@Override
protected int doWork() throws Exception {
  //this is called from the command line, so we should set to use the distributed cluster
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  Class<?>[] classes = findIntegrationTestClasses();
  LOG.info("Found " + classes.length + " integration tests to run:");
  for (Class<?> aClass : classes) {
    LOG.info("  " + aClass);
  }
  JUnitCore junit = new JUnitCore();
  junit.addListener(new TextListener(System.out));
  Result result = junit.run(classes);

  return result.wasSuccessful() ? 0 : 1;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:16,代碼來源:IntegrationTestsDriver.java

示例9: newRunListener

import org.junit.internal.TextListener; //導入依賴的package包/類
/**
 * Returns a new {@link RunListener} instance for the given {@param outputFormat}.
 */
public RunListener newRunListener(OutputFormat outputFormat) {
    switch (outputFormat) {
        case JUNIT:
            out.println("JUnit version " + Version.id());
            return new TextListener(out);
        case GTM_UNIT_TESTING:
            return new GtmUnitTestingTextListener();
        default:
            throw new IllegalArgumentException("outputFormat");
    }
}
 
開發者ID:doppllib,項目名稱:core-doppl,代碼行數:15,代碼來源:DopplJunitTestHelper.java

示例10: doWork

import org.junit.internal.TextListener; //導入依賴的package包/類
@Override
protected int doWork() throws Exception {
  //this is called from the command line, so we should set to use the distributed cluster
  IntegrationTestingUtility.setUseDistributedCluster(conf);
  Class<?>[] classes = findIntegrationTestClasses();
  LOG.info("Found " + classes.length + " integration tests to run");

  JUnitCore junit = new JUnitCore();
  junit.addListener(new TextListener(System.out));
  Result result = junit.run(classes);

  return result.wasSuccessful() ? 0 : 1;
}
 
開發者ID:fengchen8086,項目名稱:LCIndex-HBase-0.94.16,代碼行數:14,代碼來源:IntegrationTestsDriver.java

示例11: runTest

import org.junit.internal.TextListener; //導入依賴的package包/類
private static void runTest(String test) {
    try {
        String[] classAndMethod = test.split("#");
        System.out.println(test);
        Request request = Request.method(Class.forName(classAndMethod[0]), classAndMethod[1]);
        JUnitCore junit = new JUnitCore();
        junit.addListener(new TextListener(System.out));
        junit.run(request);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}
 
開發者ID:SpoonLabs,項目名稱:nopol,代碼行數:13,代碼來源:MethodTestRunner.java

示例12: didBecomeActive

import org.junit.internal.TextListener; //導入依賴的package包/類
@Override
public void didBecomeActive(UIApplication application) {
    super.didBecomeActive(application);

    NSException.registerDefaultJavaUncaughtExceptionHandler();

    Computer computer = new Computer();

    JUnitCore jUnitCore = new JUnitCore();
    jUnitCore.addListener(new TextListener(System.out));
    jUnitCore.run(computer, getTestClasses());
}
 
開發者ID:liraz,項目名稱:robolayout,代碼行數:13,代碼來源:XCTestRunner.java

示例13: newRunListener

import org.junit.internal.TextListener; //導入依賴的package包/類
/**
 * Returns a new {@link RunListener} instance for the given {@param outputFormat}.
 */
public RunListener newRunListener(OutputFormat outputFormat) {
  switch (outputFormat) {
    case JUNIT:
      out.println("JUnit version " + Version.id());
      return new TextListener(out);
    case GTM_UNIT_TESTING:
      return new GtmUnitTestingTextListener();
    default:
      throw new IllegalArgumentException("outputFormat");
  }
}
 
開發者ID:Sellegit,項目名稱:j2objc,代碼行數:15,代碼來源:JUnitTestRunner.java

示例14: run

import org.junit.internal.TextListener; //導入依賴的package包/類
public Result run(String[] args) throws Exception {

    // List all classes - adapted from JUnitCore code
    List<Class<?>> classes = new ArrayList<Class<?>>();
    List<Failure> missingClasses = new ArrayList<Failure>();
    for (String arg : args) {
      try {
        classes.add(Class.forName(arg));
      } catch (ClassNotFoundException e) {
        Description description = Description.createSuiteDescription(arg);
        Failure failure = new Failure(description, e);
        missingClasses.add(failure);
      }
    }
    // Create standard JUnitCore
    JUnitCore jcore = new JUnitCore();
    // Create default "system"
    JUnitSystem jsystem = new RealSystem();
    // Setup default listener
    jcore.addListener(new TextListener(jsystem));
    // Add XML generator listener
    jcore.addListener(new XMLTestReporter());
    Result result = jcore.run(classes.toArray(new Class[0]));
    for (Failure each : missingClasses) {
      result.getFailures().add(each);
    }
    return result;
  }
 
開發者ID:kyoren,項目名稱:https-github.com-h2oai-h2o-3,代碼行數:29,代碼來源:H2OTestRunner.java

示例15: runMain

import org.junit.internal.TextListener; //導入依賴的package包/類
/**
 * @param system
 * @param args from main()
 */
Result runMain(JUnitSystem system, String... args) {
    system.out().println("JUnit version " + Version.id());

    JUnitCommandLineParseResult jUnitCommandLineParseResult = JUnitCommandLineParseResult.parse(args);

    RunListener listener = new TextListener(system);
    addListener(listener);

    return run(jUnitCommandLineParseResult.createRequest(defaultComputer()));
}
 
開發者ID:DIVERSIFY-project,項目名稱:sosiefier,代碼行數:15,代碼來源:JUnitCore.java


注:本文中的org.junit.internal.TextListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。