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


Java TestResult类代码示例

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


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

示例1: should_verify_failed_result_for_test_method_report

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
@Test
public void should_verify_failed_result_for_test_method_report() throws ParseException {
    ExceptionHandlingTestCase.TestException exception = new ExceptionHandlingTestCase.TestException("cause");
    TestResult result = TestResult.failed(exception);

    TestMethodReport report = Reporter
            .createReport(new TestMethodReport("Report name"))
            .addEntries("entry")
            .setResult(result)
            .build();

    verifyBasicContent(report);

     FailureReport failureReport = Reporter.createReport(new FailureReport(METHOD_FAILURE_REPORT))
        .addKeyValueEntry(METHOD_FAILURE_REPORT_STACKTRACE, getHumanReadableStackTrace(result.getThrowable()))
        .build();

    // TODO: verify failure Report Generation - failure report not a sub report
    TestMethodReportAssert
        .assertThatTestMethodReport(report)
        .hasFailureReportsContainingExactly(failureReport)
        .hasStatus(TestResult.Status.FAILED);
}
 
开发者ID:arquillian,项目名称:arquillian-reporter,代码行数:24,代码来源:BuilderTest.java

示例2: should_verify_skipped_result_for_test_method_report

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
@Test
    public void should_verify_skipped_result_for_test_method_report() throws ParseException {
        ExceptionHandlingTestCase.TestException exception = new ExceptionHandlingTestCase.TestException("cause");
        TestResult result = TestResult.skipped(exception);

        TestMethodReport report = Reporter
                .createReport(new TestMethodReport("Report name"))
                .addEntries("entry")
                .setResult(result)
                .build();

        verifyBasicContent(report);

        // todo change this when throwable is supported
//        FailureReport failureReport = Reporter.createReport(new FailureReport(METHOD_FAILURE_REPORT))
//                .addKeyValueEntry(METHOD_FAILURE_REPORT_STACKTRACE, getHumanReadableStackTrace(exception))
//                .build();

        TestMethodReportAssert
                .assertThatTestMethodReport(report)
                .hasFailureSubReportsContainingExactly()
                .hasStatus(TestResult.Status.SKIPPED);
    }
 
开发者ID:arquillian,项目名称:arquillian-reporter,代码行数:24,代码来源:BuilderTest.java

示例3: should_verify_passed_result_for_test_method_report

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
@Test
public void should_verify_passed_result_for_test_method_report() throws ParseException {
    ExceptionHandlingTestCase.TestException exception = new ExceptionHandlingTestCase.TestException("cause");
    TestResult result = TestResult.passed();
    result.setThrowable(exception);

    TestMethodReport report = Reporter
            .createReport(new TestMethodReport("Report name"))
            .addEntries("entry")
            .setResult(result)
            .build();

    verifyBasicContent(report);

    TestMethodReportAssert
            .assertThatTestMethodReport(report)
            .hasFailureSubReportsContainingExactly()
            .hasStatus(TestResult.Status.PASSED);
}
 
开发者ID:arquillian,项目名称:arquillian-reporter,代码行数:20,代码来源:BuilderTest.java

示例4: decide

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
public boolean decide(org.jboss.arquillian.core.spi.event.Event event, TestResult testResult) {

            boolean taking = false;

            for (final RecorderStrategy<?> recorderStrategy : recorderStrategyRegister.getAll()) {
                if (recorderStrategy instanceof AnnotationScreenshootingStrategy && !hasScreenshotAnnotation(event)) {
                    continue;
                }
                if (testResult == null) {
                    taking = recorderStrategy.isTakingAction(event);
                } else {
                    taking = recorderStrategy.isTakingAction(event, testResult);
                }
            }

            return taking;
        }
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:18,代码来源:ScreenshooterLifecycleObserver.java

示例5: isTakingAction

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
@Override
public boolean isTakingAction(Event event, TestResult result) {
    if (event instanceof AfterTestLifecycleEvent && !(event instanceof After)) {
        Screenshot screenshotAnnotation = ScreenshotAnnotationScanner.getScreenshotAnnotation(((AfterTestLifecycleEvent) event).getTestMethod());

        if (screenshotAnnotation != null) {
            if (screenshotAnnotation.takeAfterTest()) {
                return true;
            }
            if (result.getStatus() == Status.FAILED && screenshotAnnotation.takeWhenTestFailed()) {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:18,代码来源:DefaultAnnotationScreenshootingStrategy.java

示例6: onStopRecording

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
public void onStopRecording(@Observes StopRecordVideo event) throws IOException {
    Video video = recorder.get().stopRecording();

    TestResult testResult = event.getVideoMetaData().getTestResult();

    if (testResult != null) {
        Status status = testResult.getStatus();
        appendStatus(video, status);

        resourceRegister.get().addReported(video);

        if ((status.equals(Status.PASSED) && !configuration.get().getTakeOnlyOnFail())
            || (status.equals(Status.FAILED) && configuration.get().getTakeOnlyOnFail())) {
            propertyReportEvent.fire(new PropertyReportEvent(getVideoEntry(video)));
        }
    } else {
        resourceRegister.get().addTaken(video);
    }
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:20,代码来源:VideoTaker.java

示例7: startBeforeSuiteTrueTest

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
@Test
public void startBeforeSuiteTrueTest() throws Exception {

    Mockito.when(configuration.getStartBeforeSuite()).thenReturn(true);

    fire(new VideoExtensionConfigured());

    fire(new BeforeSuite());
    fire(new BeforeClass(DummyTestCase.class));
    fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test")));

    bind(TestScoped.class, TestResult.class, TestResult.passed());

    fire(new After(DummyTestCase.class, DummyTestCase.class.getMethod("test")));
    fire(new AfterClass(DummyTestCase.class));
    fire(new AfterSuite());

    assertEventFired(BeforeVideoStart.class, 1);
    assertEventFired(StartRecordSuiteVideo.class, 1);
    assertEventFired(AfterVideoStart.class, 1);

    assertEventFired(BeforeVideoStop.class, 1);
    assertEventFired(StopRecordSuiteVideo.class, 1);
    assertEventFired(AfterVideoStop.class, 1);
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:26,代码来源:RecorderLifecycleObserverTestCase.java

示例8: startBeforeClassTrueTest

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
@Test
public void startBeforeClassTrueTest() throws Exception {

    Mockito.when(configuration.getStartBeforeClass()).thenReturn(true);

    fire(new VideoExtensionConfigured());

    fire(new BeforeSuite());
    fire(new BeforeClass(DummyTestCase.class));
    fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test")));

    bind(TestScoped.class, TestResult.class, TestResult.passed());

    fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP));
    fire(new AfterClass(DummyTestCase.class));
    fire(new AfterSuite());

    assertEventFired(BeforeVideoStart.class, 1);
    assertEventFired(StartRecordClassVideo.class, 1);
    assertEventFired(AfterVideoStart.class, 1);

    assertEventFired(BeforeVideoStop.class, 1);
    assertEventFired(StopRecordClassVideo.class, 1);
    assertEventFired(AfterVideoStop.class, 1);
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:26,代码来源:RecorderLifecycleObserverTestCase.java

示例9: startBeforeTestTrueTest

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
@Test
public void startBeforeTestTrueTest() throws Exception {

    Mockito.when(configuration.getStartBeforeTest()).thenReturn(true);

    fire(new VideoExtensionConfigured());

    fire(new BeforeSuite());
    fire(new BeforeClass(DummyTestCase.class));
    fire(new Before(DummyTestCase.class, DummyTestCase.class.getMethod("test")));

    bind(TestScoped.class, TestResult.class, TestResult.passed());

    fire(new AfterRules(DummyTestCase.class, DummyTestCase.class.getMethod("test"), LifecycleMethodExecutor.NO_OP));
    fire(new AfterClass(DummyTestCase.class));
    fire(new AfterSuite());

    assertEventFired(BeforeVideoStart.class, 1);
    assertEventFired(StartRecordVideo.class, 1);
    assertEventFired(AfterVideoStart.class, 1);

    assertEventFired(BeforeVideoStop.class, 1);
    assertEventFired(StopRecordVideo.class, 1);
    assertEventFired(AfterVideoStop.class, 1);
}
 
开发者ID:arquillian,项目名称:arquillian-recorder,代码行数:26,代码来源:RecorderLifecycleObserverTestCase.java

示例10: stopRecording

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
public void stopRecording(@Observes After afterTestMethod, TestResult testResult,
    CubeDroneConfiguration cubeDroneConfiguration, SeleniumContainers seleniumContainers) {

    if (this.vnc != null) {
        vnc.stop();
        
        Path finalLocation = null;
        if (shouldRecordOnlyOnFailure(testResult, cubeDroneConfiguration)) {
            finalLocation =
                moveFromVolumeFolderToBuildDirectory(afterTestMethod, cubeDroneConfiguration, seleniumContainers);
        } else {
            if (shouldRecordAlways(cubeDroneConfiguration)) {
                finalLocation =
                    moveFromVolumeFolderToBuildDirectory(afterTestMethod, cubeDroneConfiguration, seleniumContainers);
            }
        }

        vnc.destroy();

        this.afterVideoRecordedEvent.fire(new AfterVideoRecorded(afterTestMethod, finalLocation));
    }
}
 
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:23,代码来源:VncRecorderLifecycleManager.java

示例11: doRunTestMethod

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
@Override
protected TestResult doRunTestMethod(TestRunner runner, Class<?> testClass, String methodName, Map<String, String> protocolProps) {
    ClassLoader runWithClassLoader = ClassLoader.getSystemClassLoader();
    if (Boolean.parseBoolean(protocolProps.get(ExtendedJMXProtocolConfiguration.PROPERTY_ENABLE_TCCL))) {
        ArquillianConfig config = getArquillianConfig(testClass.getName(), 30000L);
        DeploymentUnit depUnit = config.getDeploymentUnit().getValue();
        Module module = depUnit.getAttachment(Attachments.MODULE);
        if (module != null) {
            runWithClassLoader = module.getClassLoader();
        }
    }
    ClassLoader tccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(runWithClassLoader);
    try {
        return super.doRunTestMethod(runner, testClass, methodName, protocolProps);
    } finally {
        WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(tccl);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-arquillian,代码行数:19,代码来源:ArquillianService.java

示例12: getExecutor

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
@Override
public ContainerMethodExecutor getExecutor(FurnaceProtocolConfiguration protocolConfiguration,
         ProtocolMetaData metaData, CommandCallback callback)
{
   if (metaData == null)
   {
      return new ContainerMethodExecutor()
      {
         @Override
         public TestResult invoke(TestMethodExecutor arg0)
         {
            return TestResult.skipped();
         }
      };
   }

   Collection<FurnaceHolder> contexts = metaData.getContexts(FurnaceHolder.class);
   if (contexts.size() == 0)
   {
      throw new IllegalArgumentException(
               "No " + Furnace.class.getName() + " found in " + ProtocolMetaData.class.getName() + ". " +
                        "Furnace protocol can not be used");
   }
   return new FurnaceTestMethodExecutor(protocolConfiguration, contexts.iterator().next());
}
 
开发者ID:forge,项目名称:furnace,代码行数:26,代码来源:FurnaceProtocol.java

示例13: getExecutor

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
@Override
public ContainerMethodExecutor getExecutor(ForgeProtocolConfiguration protocolConfiguration,
         ProtocolMetaData metaData, CommandCallback callback)
{
   if (metaData == null)
   {
      return new ContainerMethodExecutor()
      {
         @Override
         public TestResult invoke(TestMethodExecutor arg0)
         {
            return new TestResult(Status.SKIPPED);
         }
      };
   }

   Collection<FurnaceHolder> contexts = metaData.getContexts(FurnaceHolder.class);
   if (contexts.size() == 0)
   {
      throw new IllegalArgumentException(
               "No " + Furnace.class.getName() + " found in " + ProtocolMetaData.class.getName() + ". " +
                        "Furnace protocol can not be used");
   }
   return new ForgeTestMethodExecutor(protocolConfiguration, contexts.iterator().next());
}
 
开发者ID:koentsje,项目名称:forge-furnace,代码行数:26,代码来源:ForgeProtocol.java

示例14: stopTestMethod

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
public void stopTestMethod(@Observes(precedence = Integer.MIN_VALUE) AfterTestLifecycleEvent event,
    TestResult result) {
    if (!(event instanceof After)) {
        Method testMethod = event.getTestMethod();
        String reportMessage = ReportMessageParser.parseTestReportMessage(event.getTestMethod());

        Reporter
            .createReport(new TestMethodReport(testMethod.getName()))
            .stop()
            .setResult(result)
            .addKeyValueEntry(TEST_METHOD_REPORT_MESSAGE, reportMessage)
            .inSection(new TestMethodSection(testMethod))
            .fire(sectionEvent);
    }
}
 
开发者ID:arquillian,项目名称:arquillian-reporter,代码行数:16,代码来源:ArquillianCoreReporterLifecycleManager.java

示例15: verify_method_report_for_run_as_client_test

import org.jboss.arquillian.test.spi.TestResult; //导入依赖的package包/类
@Test
public void verify_method_report_for_run_as_client_test() {
    final TestMethodReport run_client_test_report = getTestMethodReport("run_client_test");

    assertThatTestMethodReport(run_client_test_report)
        .hasStatus(TestResult.Status.PASSED)
        .hasEntriesContaining(new KeyValueEntry(ArquillianCoreKey.TEST_METHOD_RUNS_AS_CLIENT, "true"));
}
 
开发者ID:arquillian,项目名称:arquillian-reporter,代码行数:9,代码来源:GreeterReportVerifier.java


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