Search in sources :

Example 1 with MiniTestReport

use of de.ipk_gatersleben.bit.bi.bridge.brapicomp.dbentities.MiniTestReport in project IPK-BrAPI-Validator by plantbreeding.

the class TestReportResource method generateCSVReport.

private String generateCSVReport(TestReport tr) throws JsonProcessingException, IOException {
    String csv = "";
    MiniTestReport miniReport = tr.getMiniReport();
    // Columns
    String resourceName = tr.getResource().getName();
    String baseURL = tr.getResourceUrl();
    String warningCalls = miniReport.getWarningTests().toString();
    String failedCalls = miniReport.getFailedTests().toString();
    String testedCalls = miniReport.getTotalTests().toString();
    String warningCallsCount = "" + miniReport.getWarningTests().size();
    String failedCallsCount = "" + miniReport.getFailedTests().size();
    String testedCallsCount = "" + miniReport.getTotalTests().size();
    String medianTestTime = Double.toString(miniReport.getTime());
    String linkFullTest = Config.get("baseDomain") + "?report=" + tr.getReportId().toString();
    List<String> header = Arrays.asList("resourceName", "baseURL", "warningCalls", "failedCalls", "testedCalls", "warningCallsCount", "failedCallsCount", "testedCallsCount", "medianTestTimeMS", "linkFullTest");
    csv += CSVUtils.writeLine(header, '\t');
    List<String> values = Arrays.asList(resourceName, baseURL, warningCalls, failedCalls, testedCalls, warningCallsCount, failedCallsCount, testedCallsCount, medianTestTime, linkFullTest);
    csv += CSVUtils.writeLine(values, '\t');
    return csv;
}
Also used : MiniTestReport(de.ipk_gatersleben.bit.bi.bridge.brapicomp.dbentities.MiniTestReport)

Example 2 with MiniTestReport

use of de.ipk_gatersleben.bit.bi.bridge.brapicomp.dbentities.MiniTestReport in project IPK-BrAPI-Validator by plantbreeding.

the class TestReportResource method generateJSONReport.

private String generateJSONReport(TestReport tr) throws IOException {
    Map<String, Object> json = new HashMap<String, Object>();
    MiniTestReport miniReport = tr.getMiniReport();
    json.put("resourceName", tr.getResource().getName());
    json.put("baseURL", tr.getResourceUrl());
    json.put("implementedCalls", miniReport.getTotalTests());
    json.put("successfulCalls", miniReport.getPassedTests());
    json.put("failedCalls", miniReport.getFailedTests());
    json.put("medianTestTimeMS", miniReport.getTime());
    json.put("linkFullTest", Config.get("baseDomain") + "?report=" + tr.getReportId().toString());
    ObjectMapper mapper = new ObjectMapper();
    return mapper.writeValueAsString(json);
}
Also used : MiniTestReport(de.ipk_gatersleben.bit.bi.bridge.brapicomp.dbentities.MiniTestReport) HashMap(java.util.HashMap) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

MiniTestReport (de.ipk_gatersleben.bit.bi.bridge.brapicomp.dbentities.MiniTestReport)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 HashMap (java.util.HashMap)1