/** * Start test-case. * * @param testSuite test-suite instance. * @param testCase test-case instance. */ public static void startTestCase(ITestSuite testSuite, ITestCase testCase) { TestCaseResult caseResult = factory.createTestCaseResult(testCase.getName()); map.put(testCase, caseResult); if (testSuite != null) { TestSuiteResult suiteResult = (TestSuiteResult) map.get(testSuite); suiteResult.addTestCaseResult(caseResult); } }
/** * End test-suite. * * @param testSuite test-suite instatnce. */ public static void endTestSuite(ITestSuite testSuite) { TestSuiteResult suiteResult = (TestSuiteResult) map.remove(testSuite); suiteResult.endTestSuite(); if (resultDir == null) return; try { Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); // marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); File file = new File(resultDir, "TEST-" + suiteResult.getName() + ".xml"); marshaller.marshal(suiteResult, file); } catch (JAXBException e) { throw new RuntimeException(e); } }
/** * Add property in test-suite. * * @param testSuite test-suite instatnce. * @param name property name. * @param value property value. */ public static void addProperty(ITestSuite testSuite, String name, String value) { TestSuiteResult suiteResult = (TestSuiteResult) map.get(testSuite); suiteResult.addProperty(name, value); }