Search in sources :

Example 11 with TestScenario

use of jp.ossc.nimbus.service.test.TestScenario in project nimbus by nimbus-org.

the class HtmlTestCaseProgressReporterService method reportScenarioGroup.

private void reportScenarioGroup(PrintWriter pw, TestController controller, TestScenarioGroup group) throws Exception {
    TestScenario[] scenarios = controller.getScenarios(group.getScenarioGroupId());
    Map scenarioTestcaseMap = new TreeMap();
    int testCaseCount = 0;
    for (int index = 0; index < scenarios.length; index++) {
        TestCase[] cases = controller.getTestCases(group.getScenarioGroupId(), scenarios[index].getScenarioId());
        if (cases.length == 0) {
            testCaseCount++;
        } else {
            testCaseCount += cases.length;
        }
        scenarioTestcaseMap.put(scenarios[index].getScenarioId(), cases);
    }
    TestScenarioGroupResource groupResource = group.getTestScenarioGroupResource();
    pw.println("<tr>");
    printResource(pw, groupResource, group.getScenarioGroupId(), "rowgroup", testCaseCount);
    Iterator ite = scenarioTestcaseMap.keySet().iterator();
    boolean isFirst = true;
    while (ite.hasNext()) {
        String scenarioId = (String) ite.next();
        TestScenario testScenario = controller.getScenario(group.getScenarioGroupId(), scenarioId);
        TestScenario.TestScenarioResource testScenarioResource = testScenario.getTestScenarioResource();
        if (testScenarioResource == null) {
            continue;
        }
        TestCase[] cases = (TestCase[]) scenarioTestcaseMap.get(scenarioId);
        int count = cases.length;
        if (count == 0) {
            count = 1;
        }
        if (!isFirst) {
            pw.println("<tr>");
        }
        isFirst = false;
        printResource(pw, testScenarioResource, scenarioId, "rowgroup", count);
        if (cases.length == 0) {
            pw.println("</tr>");
        } else {
            printResource(pw, cases[0].getTestCaseResource(), cases[0].getTestCaseId(), "row", 0);
            pw.println("</tr>");
            for (int index = 1; index < cases.length; index++) {
                pw.println("<tr>");
                printResource(pw, cases[index].getTestCaseResource(), cases[index].getTestCaseId(), "row", 0);
                pw.println("</tr>");
            }
        }
    }
}
Also used : TestScenarioGroupResource(jp.ossc.nimbus.service.test.TestScenarioGroup.TestScenarioGroupResource) TestCase(jp.ossc.nimbus.service.test.TestCase) TestScenario(jp.ossc.nimbus.service.test.TestScenario) Iterator(java.util.Iterator) TreeMap(java.util.TreeMap) TreeMap(java.util.TreeMap) Map(java.util.Map)

Aggregations

TestScenario (jp.ossc.nimbus.service.test.TestScenario)11 TestScenarioGroup (jp.ossc.nimbus.service.test.TestScenarioGroup)8 TestCase (jp.ossc.nimbus.service.test.TestCase)7 Iterator (java.util.Iterator)5 Map (java.util.Map)5 BufferedWriter (java.io.BufferedWriter)2 FileOutputStream (java.io.FileOutputStream)2 FileWriter (java.io.FileWriter)2 IOException (java.io.IOException)2 BigDecimal (java.math.BigDecimal)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 TreeMap (java.util.TreeMap)2 OutputStreamWriter (java.io.OutputStreamWriter)1 PrintWriter (java.io.PrintWriter)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1