}
}
+ public static void printTestResultXmlFormat() {
+ //get file name of test result
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
+ String testFileName = formatter.format(imStartTime) + ".xml";
+
+ String testResultFilePath = PathUtil.get(InstallManagerConstants.getInstallManagerTestResultPath(), testFileName);
+ File testResultFile = new File(testResultFilePath);
+
+ if (!testResultFile.getParentFile().exists()) {
+ testResultFile.getParentFile().mkdirs();
+ }
+
+ BufferedWriter out = null;
+ try {
+ out = new BufferedWriter(new FileWriter(testResultFile));
+ out.write(getTestSuiteXml("InstallManager performance test", 4, getTotalTime()));
+ out.newLine();
+ out.write(getTestCaseXml("The initialization time", getInitializeTime()));
+ out.newLine();
+ out.write(getTestCaseXml("The download time", getDownloadTime()));
+ out.newLine();
+ out.write(getTestCaseXml("The installation time", getInstallationTime()));
+ out.newLine();
+ out.write(getTestCaseXml("The removal time", getRemovalTime()));
+ out.newLine();
+ out.write("</testsuite>");
+ } catch (IOException e) {
+ Log.ExceptionLog(e);
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ Log.ExceptionLog(e);
+ }
+ }
+ }
+ }
+
+ private static String getTestSuiteXml(String testName, int testNum, long time) {
+ return "<testsuite errors=\"\" failures=\"\" name=\"" + testName + "\" skips=\"\" tests=\"" + testNum +"\" time=\""+ time +"\">";
+ }
+
+ private static String getTestCaseXml(String testName, long time) {
+ return "<testcase classname=\"\" name=\"" + testName + "\" time=\"" + time +"\"/>";
+ }
+
private static long getInitializeTime() {
if (initializeStartTime == null || initializeEndTime == null) {
return 0;
Performance.setIMEndTime();
if (Options.doTest) {
- Performance.printTestResult();
+ Performance.printTestResultXmlFormat();
}
System.exit(0);
Performance.printToLogFile();
if (Options.doTest) {
- Performance.printTestResult();
+ Performance.printTestResultXmlFormat();
}
Log.LogTitle("Installmanager finish");