Ejemplo n.º 1
0
        public string DumpLogs()
        {
            StringBuilder resultOverview = new StringBuilder();

            testResultPath = Path.Combine(TestRunPath, packageId + ".htm");
            HTMLLogger logger = new HTMLLogger();

            logger.WriteSummary();
            logger.WriteTestCaseResultTableHeader(new string[] { "Scenario", "Result", "Details" }, true);
            foreach (Tuple <string, string, string> result in resultsDict)
            {
                logger.WriteTestCaseResult(result.Item1, result.Item2, result.Item3.Replace("<<<<", ""));
                resultOverview.AppendFormat("{0}:{1}; ", result.Item1, result.Item2);
            }
            StreamReader sr   = new StreamReader("PackageResultsTemplate.htm");
            string       body = sr.ReadToEnd();

            sr.Close();
            body = body.Replace("{Rows}", logger.stringwriter.ToString());
            body = body.Replace("{PackageID}", packageId);

            StreamWriter sw = new StreamWriter(testResultPath);

            sw.Write(body);
            sw.Flush();
            sw.Close();
            return(resultOverview.ToString());
        }
Ejemplo n.º 2
0
        public static void DumpLog()
        {
            HTMLLogger logger = new HTMLLogger();

            logger.WriteTestCaseResultTableHeader(new string[] { "Package", "Result", "Result file Path" }, true);
            foreach (Tuple <string, string, string> result in resultsDict)
            {
                logger.WriteTestCaseResultWithoutLink(result.Item1, result.Item2, result.Item3);
            }
            StreamReader sr   = new StreamReader("ConsolidatedResultsTemplate.htm");
            string       body = sr.ReadToEnd();

            sr.Close();
            body = body.Replace("{Rows}", logger.stringwriter.ToString());
            if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["SmtpUserName"]) && !string.IsNullOrEmpty(ConfigurationManager.AppSettings["SmtpPassword"]) && !string.IsNullOrEmpty(ConfigurationManager.AppSettings["MailRecepientAddress"]))
            {
                MailHelper.SendMail(body);
            }
            StreamWriter sw = new StreamWriter(Path.Combine(AppSettingsHelper.TestResultsPathKeyValue, "Consolidated" + ".htm"));

            sw.Write(body);
            sw.Flush();
            sw.Close();
        }