当前位置: 首页>>代码示例>>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;未经允许,请勿转载。