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>");
}
}
}
}
Aggregations