Пример #1
0
  private TestResult createTest(CollectorItem collectorItem, TestDataCreateRequest request) {
    TestResult testResult =
        testResultRepository.findByCollectorItemIdAndExecutionId(
            collectorItem.getId(), request.getExecutionId());
    if (testResult == null) {
      testResult = new TestResult();
    }

    testResult.setTargetAppName(request.getTargetAppName());
    testResult.setTargetEnvName(request.getTargetEnvName());
    testResult.setCollectorItemId(collectorItem.getId());
    testResult.setType(request.getType());
    testResult.setDescription(request.getDescription());
    testResult.setDuration(request.getDuration());
    testResult.setEndTime(request.getEndTime());
    testResult.setExecutionId(request.getExecutionId());
    testResult.setFailureCount(request.getFailureCount());
    testResult.setSkippedCount(request.getSkippedCount());
    testResult.setStartTime(request.getStartTime());
    testResult.setSuccessCount(request.getSuccessCount());
    testResult.setTimestamp(request.getTimestamp());
    testResult.setTotalCount(request.getTotalCount());
    testResult.setUnknownStatusCount(request.getUnknownStatusCount());
    testResult.setUrl(request.getTestJobUrl());
    testResult.getTestCapabilities().addAll(request.getTestCapabilities());
    testResult.setBuildId(new ObjectId(request.getTestJobId()));

    return testResultRepository.save(testResult);
  }
Пример #2
0
  @Override
  public void onFinish(ITestContext testContext) {
    super.onFinish(testContext);
    IResultMap passedMap = testContext.getPassedTests();
    IResultMap failedMap = testContext.getFailedTests();

    testResult.setEndTime(ts.getTime(":"));
    testResult.setDuration("");
    testResult.setFailCount(String.valueOf(failedMap.size()));
    testResult.setPassCount(String.valueOf(passedMap.size()));
    testResult.setTotalCount(String.valueOf(failedMap.size() + passedMap.size()));
    logger.info("testContext.getName()=" + testContext.getName());
    initTestCaseInfo();

    ITestClass className = testContext.getAllTestMethods()[0].getTestClass();
    WriteResultUtils utils = new WriteResultUtils();
    utils.writeResultSummary(testResult, getTemplatePath(className.getName()));
  }