当前位置: 首页>>代码示例>>Java>>正文


Java Computer类代码示例

本文整理汇总了Java中org.junit.runner.Computer的典型用法代码示例。如果您正苦于以下问题:Java Computer类的具体用法?Java Computer怎么用?Java Computer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Computer类属于org.junit.runner包,在下文中一共展示了Computer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import org.junit.runner.Computer; //导入依赖的package包/类
@Override
public void run() throws EngineException {
    try {
        Result result = jUnitCore.run(new Computer(), suite.tests());
        System.out.println(
                String.format(
                        "Total tests run: %s, Failures: %s, Skips: %s",
                        result.getRunCount(),
                        result.getFailureCount(),
                        result.getIgnoreCount()
                )
        );
        System.exit(result.wasSuccessful() ? 0 : -1);
    } catch (SuiteException e) {
        throw new EngineException("Some problem occurs in the Junit4 engine", e);
    }
}
 
开发者ID:tatools,项目名称:sunshine,代码行数:18,代码来源:Junit4Engine.java

示例2: testSystem

import org.junit.runner.Computer; //导入依赖的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

示例3: execClass

import org.junit.runner.Computer; //导入依赖的package包/类
private void execClass(final TestClassExecutionData o) {
    classData = o;
    CLASS_DATA_IN_CONTEXT.set(o);
    try {
        HtmlRunReporter reporter = o.getHtmlRunReporter();
        reporter.hiddenBeforeTestClassExecution();
        core.addListener(reporter);

        Result result = core.run(Computer.serial(), o.getTestClass());
        for (Failure failure : result.getFailures()) {
            LOGGER.debug(failure.toString());
        }
        classData.setCountOfRuns(result.getRunCount());
        core.removeListener(reporter);
        reporter.hiddenAfterTestClassExecution();
    } catch (Throwable e) {
        //this is gas
        LOGGER.debug("Thread: got EX during JUnitCore execution.", e);
    }
    CLASS_DATA_IN_CONTEXT.set(null);
    classData = null;
}
 
开发者ID:epam,项目名称:Gepard,代码行数:23,代码来源:TestClassExecutionThread.java

示例4: status

import org.junit.runner.Computer; //导入依赖的package包/类
/**
 * Returns status of JUnite tests execution.
 *
 * @return the status
 * @throws KernelException if any error occurs during JUnit tests execution.
 */
@Override
public Status status() throws KernelException {
    try {
        return new JunitStatus(this.junit.run(new Computer(), this.suiteForRun.tests()));
    } catch (SuiteException e) {
        throw new KernelException("Some problem occurs in the Junit4Kernel", e);
    }
}
 
开发者ID:tatools,项目名称:sunshine,代码行数:15,代码来源:Junit4Kernel.java

示例5: didBecomeActive

import org.junit.runner.Computer; //导入依赖的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

示例6: build

import org.junit.runner.Computer; //导入依赖的package包/类
/**
 * Builds the {@link android.support.test.internal.runner.TestRequest} based on current contents of added classes and methods.
 * <p/>
 * If no classes have been explicitly added, will scan the classpath for all tests.
 */
public TestRequest build(Instrumentation instr, Bundle bundle) {
    if (mTestLoader.isEmpty()) {
        // no class restrictions have been specified. Load all classes
        loadClassesFromClassPath();
    }

    Request request = classes(
            new AndroidRunnerParams(instr, bundle, mSkipExecution, mPerTestTimeout),
            new Computer(),
            mTestLoader.getLoadedClasses().toArray(new Class[0]));
    return new TestRequest(mTestLoader.getLoadFailures(),
            new LenientFilterRequest(request, mFilter));
}
 
开发者ID:mg6maciej,项目名称:android-groovy-dagger-espresso-demo,代码行数:19,代码来源:SpockTestRequestBuilder.java

示例7: sortTestsInMultipleClasses

import org.junit.runner.Computer; //导入依赖的package包/类
@Test
public void sortTestsInMultipleClasses() {
    Request request = Request.classes(Computer.serial(), TwoTests.class,
            TwoTests.class);
    fMax.run(request);
    List<Description> tests = fMax.sortedLeavesForTest(request);
    Description dontSucceed = Description.createTestDescription(
            TwoTests.class, "dontSucceed");
    assertEquals(dontSucceed, tests.get(0));
    assertEquals(dontSucceed, tests.get(1));
}
 
开发者ID:DIVERSIFY-project,项目名称:sosiefier,代码行数:12,代码来源:MaxStarterTest.java

示例8: runTests

import org.junit.runner.Computer; //导入依赖的package包/类
/**
 * Method to execute all tests
 *
 * @param filename: Filename for the properties file
 */
private static void runTests(String filename) {
    System.setProperty("PROPSFILENAME", filename);
    JUnitCore core = new JUnitCore();
    core.run(new Computer(), AllTests.class);

}
 
开发者ID:nitinmendiratta,项目名称:WikiIndexer,代码行数:12,代码来源:Runner.java

示例9: runTests

import org.junit.runner.Computer; //导入依赖的package包/类
/**
 * Method to execute all tests
 * @param filename: Filename for the properties file
 */
private static void runTests(String filename) {
	System.setProperty("PROPSFILENAME", filename);
	JUnitCore core = new JUnitCore();
	core.run(new Computer(), AllTests.class);
	
}
 
开发者ID:nitinmendiratta,项目名称:WikiIndexer,代码行数:11,代码来源:SingleRunner.java

示例10: runJunitTestWithComputer

import org.junit.runner.Computer; //导入依赖的package包/类
private Result runJunitTestWithComputer(Computer computer, Class<?> clazz) {
    Result result = JUnitCore.runClasses(computer, clazz);
    
    List<Failure> failures = result.getFailures();
    for(Failure failure : failures) {
        System.out.println(failure.getMessage());
    }
    return result;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:10,代码来源:GroovyRunnerTest.java

示例11: run

import org.junit.runner.Computer; //导入依赖的package包/类
@Override
public void run() throws Throwable {
  Level stdOutLogLevel = Level.INFO;
  Level stdErrLogLevel = Level.WARNING;

  String unparsedStdOutLogLevel = System.getProperty(STD_OUT_LOG_LEVEL_PROPERTY);
  String unparsedStdErrLogLevel = System.getProperty(STD_ERR_LOG_LEVEL_PROPERTY);

  if (unparsedStdOutLogLevel != null) {
    stdOutLogLevel = Level.parse(unparsedStdOutLogLevel);
  }

  if (unparsedStdErrLogLevel != null) {
    stdErrLogLevel = Level.parse(unparsedStdErrLogLevel);
  }

  for (String className : testClassNames) {
    final Class<?> testClass = Class.forName(className);

    List<TestResult> results = new ArrayList<>();
    RecordingFilter filter = new RecordingFilter();
    if (mightBeATestClass(testClass)) {
      JUnitCore jUnitCore = new JUnitCore();
      Runner suite = new Computer().getSuite(createRunnerBuilder(), new Class<?>[] {testClass});
      Request request = Request.runner(suite);
      request = request.filterWith(filter);
      jUnitCore.addListener(new TestListener(results, stdOutLogLevel, stdErrLogLevel));
      jUnitCore.run(request);
    }
    // Combine the results with the tests we filtered out
    List<TestResult> actualResults = combineResults(results, filter.filteredOut);
    writeResult(className, actualResults);
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:35,代码来源:JUnitRunner.java

示例12: classes

import org.junit.runner.Computer; //导入依赖的package包/类
public static Computer classes() {
    return new ParallelComputer(true, false);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:4,代码来源:ParallelComputer.java

示例13: methods

import org.junit.runner.Computer; //导入依赖的package包/类
public static Computer methods() {
    return new ParallelComputer(false, true);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:4,代码来源:ParallelComputer.java

示例14: defaultComputer

import org.junit.runner.Computer; //导入依赖的package包/类
static Computer defaultComputer() {
    return new Computer();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:4,代码来源:MarathonTestRunner.java

示例15: testCustomJUnitRunnerWithComputer

import org.junit.runner.Computer; //导入依赖的package包/类
@Test
public void testCustomJUnitRunnerWithComputer() throws CompilationFailedException, IOException {
    String filename = "src/test/resources/groovy/GroovyRunnerTest.groovy";
    
    Computer computer = new SeleniumComputer("http://www.papajohns.co.uk");
    
    Result result = runJunitTestWithComputer(computer, getGroovyClass(filename));
    
    assertEquals(0, result.getFailureCount());
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:11,代码来源:GroovyRunnerTest.java


注:本文中的org.junit.runner.Computer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。