/** @see org.junit.runners.ParentRunner#getChildren() */ @Override protected List<TestInfo> getChildren() { List<TestInfo> children = new ArrayList<>(); for (TestPlanInfo planInfo : testPlans) { planInfo.runner = new TestPlanRunner(); List<TestGroupType> groups = planInfo.plan.getTestGroup(); for (TestGroupType group : groups) { for (TestType test : group.getTest()) { TestInfo testInfo = new TestInfo(); if (testPlans.size() > 1) { testInfo.name = planInfo.name + " / " + test.getName(); } else { testInfo.name = test.getName(); } testInfo.plan = planInfo; testInfo.group = group; testInfo.test = test; children.add(testInfo); } } } return children; }
/** * Loads the test plans. * * @param testClass * @throws InitializationError */ private void loadTestPlans(Class<?> testClass) throws InitializationError { try { GatewayRestTestPlan annotation = testClass.getAnnotation(GatewayRestTestPlan.class); if (annotation == null) { throw new InitializationError("Missing @GatewayRestTestPlan annotation on test class."); } else { TestPlanInfo planInfo = new TestPlanInfo(); planInfo.planPath = annotation.value(); planInfo.name = new File(planInfo.planPath).getName(); planInfo.plan = TestUtil.loadTestPlan(planInfo.planPath, testClass.getClassLoader()); testPlans.add(planInfo); } } catch (Throwable e) { throw new InitializationError(e); } if (testPlans.isEmpty()) { throw new InitializationError( "No @GatewayRestTestPlan annotations found on test class: " + testClass); } }