Exemple #1
0
        private static string TestResultsToHTML(string jobId, TestResultsResponse data)
        {
            StringBuilder sb            = new StringBuilder();
            string        overallResult = data.allPass ? "PASS" : "FAIL";

            sb.Append($"<h1>Job ID: {jobId} </h1>");
            sb.Append($"<h2>Overall Result: {overallResult} </h2>");

            sb.Append($"<table>");
            foreach (var result in data.testResults)
            {
                foreach (var c in result.counters)
                {
                    sb.Append($"<tr>");

                    sb.Append($"<td>{result.deviceModel}</td>");
                    sb.Append($"<td>{result.deviceName}</td>");
                    sb.Append($"<td>{result.testName}</td>");
                    sb.Append($"<td>{c._name}</td>");
                    string passfail      = c._value == 1 ? "Pass" : "Fail";
                    string passfailstyle = c._value == 1 ? "background-color: lightgreen" : "background-color: red";
                    sb.Append($"<td style=\"{passfailstyle}\">{passfail}</td>");

                    sb.Append($"</tr>");
                }
            }
            sb.Append($"</table>");

            sb.Append($"<pre>{data.rawResponse}</pre>");


            return(sb.ToString());
        }
Exemple #2
0
        private static void TestResultsToXML(TestResultsResponse data)
        {
            var tests = new List <ReportingManager.TestData>();

            foreach (var result in data.testResults)
            {
                foreach (var c in result.counters)
                {
                    var testData = new ReportingManager.TestData();
                    testData.TestName = $"{result.deviceModel}:{result.deviceName}:{result.testName}:{c._name}";
                    testData.Status   = c._value == 1 ? ReportingManager.TestStatus.Pass.ToString() : ReportingManager.TestStatus.Fail.ToString();
                    tests.Add(testData);
                }
            }

            ReportingManager.GenerateXmlReport(tests, Path.Combine(CloudTestConfig.BuildFolder, "cloud-test-report.xml"));
        }