public static HtmlTextWriter AddEnvironment(this HtmlTextWriter writer, string id = "") { writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id); writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddTag(HtmlTextWriterTag.B, "Environment information: "); writer.RenderBeginTag(HtmlTextWriterTag.P); writer.Write(Bullet.HtmlCode + "CLR version: " + Environment.Version); writer.RenderEndTag(); writer.RenderBeginTag(HtmlTextWriterTag.P); writer.Write(Bullet.HtmlCode + "OS version: " + Environment.OSVersion.VersionString); writer.RenderEndTag(); writer.RenderBeginTag(HtmlTextWriterTag.P); writer.Write(Bullet.HtmlCode + "Platform: " + Environment.OSVersion.Platform); writer.RenderEndTag(); writer.RenderBeginTag(HtmlTextWriterTag.P); writer.Write(Bullet.HtmlCode + "Machine name: " + Environment.MachineName); writer.RenderEndTag(); writer.RenderBeginTag(HtmlTextWriterTag.P); writer.Write(Bullet.HtmlCode + "User domain: " + Environment.UserDomainName); writer.RenderEndTag(); writer.RenderBeginTag(HtmlTextWriterTag.P); writer.Write(Bullet.HtmlCode + "User: " + Environment.UserName); writer.RenderEndTag(); writer.RenderEndTag();//DIV return writer; }
public static HtmlTextWriter AddTestEvents(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string id = "") { writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id); writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px"); writer.RenderBeginTag(HtmlTextWriterTag.Div); var events = nunitGoTest.Events.OrderBy(x => x.Started); foreach (var testEvent in events) { writer.RenderBeginTag(HtmlTextWriterTag.P); writer.AddTag(HtmlTextWriterTag.B, "Test event: "); writer.Write(testEvent.Name); writer.RenderEndTag(); //P writer.RenderBeginTag(HtmlTextWriterTag.P); writer.Write(Bullet.HtmlCode + "Started: " + testEvent.Started.ToString("dd.MM.yy HH:mm:ss.fff")); writer.RenderEndTag(); writer.RenderBeginTag(HtmlTextWriterTag.P); writer.Write(Bullet.HtmlCode + "Finished: " + testEvent.Finished.ToString("dd.MM.yy HH:mm:ss.fff")); writer.RenderEndTag(); writer.RenderBeginTag(HtmlTextWriterTag.P); writer.Write(Bullet.HtmlCode + "Duration: " + testEvent.DurationString); writer.RenderEndTag(); } if (!events.Any()) writer.Write("There are no test events in this test"); writer.RenderEndTag();//DIV return writer; }
public static HtmlTextWriter AddTestHistory(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string id = "") { writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id); writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.AddAttribute(HtmlTextWriterAttribute.Id, Output.GetHistoryChartId(nunitGoTest.Guid, nunitGoTest.DateTimeFinish)); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderEndTag();//DIV writer.RenderEndTag();//DIV return writer; }
public static HtmlTextWriter AddTestResult(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string id = "") { writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id); writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderBeginTag(HtmlTextWriterTag.P); writer.AddTag(HtmlTextWriterTag.B, "Test full name: "); writer.Write(nunitGoTest.FullName); writer.RenderEndTag(); //P writer.RenderBeginTag(HtmlTextWriterTag.P); writer.AddTag(HtmlTextWriterTag.B, "Test name: "); writer.Write(nunitGoTest.Name); writer.RenderEndTag(); //P writer.RenderBeginTag(HtmlTextWriterTag.P); writer.AddTag(HtmlTextWriterTag.B, "Test duration: "); writer.Write(TimeSpan.FromSeconds(nunitGoTest.TestDuration).ToString(@"hh\:mm\:ss\:fff")); writer.RenderEndTag(); //P writer.RenderBeginTag(HtmlTextWriterTag.P); writer.AddTag(HtmlTextWriterTag.B, "Time period: "); var start = nunitGoTest.DateTimeStart.ToString("dd.MM.yy HH:mm:ss.fff"); var end = nunitGoTest.DateTimeFinish.ToString("dd.MM.yy HH:mm:ss.fff"); writer.Write(start + " - " + end); writer.RenderEndTag(); //P writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, nunitGoTest.GetColor()); writer.RenderBeginTag(HtmlTextWriterTag.P); writer.RenderBeginTag(HtmlTextWriterTag.B); writer.Write("Test result: "); writer.RenderEndTag(); //B writer.Write(nunitGoTest.Result); writer.RenderEndTag(); //P writer.RenderEndTag(); //DIV return writer; }
public static HtmlTextWriter AddScreenshots(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string id = "") { writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id); writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px"); writer.RenderBeginTag(HtmlTextWriterTag.Div); var screens = nunitGoTest.Screenshots.OrderBy(x => x.Date); foreach (var screenshot in screens) { writer.Write("Screenshot (Date: " + screenshot.Date.ToString("dd.MM.yy HH:mm:ss.fff") + "):"); writer.AddAttribute(HtmlTextWriterAttribute.Href, @"./../../Screenshots/" + screenshot.Name); writer.RenderBeginTag(HtmlTextWriterTag.A); writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%"); writer.AddAttribute(HtmlTextWriterAttribute.Src, @"./../../Screenshots/" + screenshot.Name); writer.AddAttribute(HtmlTextWriterAttribute.Alt, screenshot.Name); writer.RenderBeginTag(HtmlTextWriterTag.Img); writer.RenderEndTag();//IMG writer.RenderEndTag();//A } if(!screens.Any()) writer.Write("There are no screenshots in this test"); writer.RenderEndTag();//DIV return writer; }
public static HtmlTextWriter AddOutput(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string testOutput, string id = "") { writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id); writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px"); writer.RenderBeginTag(HtmlTextWriterTag.Div); if (nunitGoTest.HasOutput) { writer.RenderBeginTag(HtmlTextWriterTag.P); writer.AddTag(HtmlTextWriterTag.B, "Test output: "); writer.Write(NunitTestHtml.GenerateTxtView(testOutput)); writer.RenderEndTag(); //P } else { writer.Write("Test output is empty"); } writer.RenderEndTag();//DIV return writer; }
public static HtmlTextWriter AddFailure(this HtmlTextWriter writer, NunitGoTest nunitGoTest, string id = "") { writer.AddAttribute(HtmlTextWriterAttribute.Id, id.Equals("") ? "table-cell" : id); writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "20px"); writer.RenderBeginTag(HtmlTextWriterTag.Div); if (!nunitGoTest.IsSuccess()) { writer.RenderBeginTag(HtmlTextWriterTag.P); writer.AddTag(HtmlTextWriterTag.B, "Message: "); writer.Write(NunitTestHtml.GenerateTxtView(nunitGoTest.TestMessage)); writer.RenderEndTag(); //P writer.RenderBeginTag(HtmlTextWriterTag.P); writer.AddTag(HtmlTextWriterTag.B, "Stack trace: "); writer.Write(NunitTestHtml.GenerateTxtView(nunitGoTest.TestStackTrace)); writer.RenderEndTag(); //P } else { writer.Write("Test was successful, there is no failure message"); } writer.RenderEndTag();//DIV return writer; }
public static void OpenTreeItem(this HtmlTextWriter writer, string name, string id, string fontSize = "100%", bool isChecked = true) { writer.RenderBeginTag(HtmlTextWriterTag.Ul); writer.RenderBeginTag(HtmlTextWriterTag.Li); writer.AddAttribute(HtmlTextWriterAttribute.Type, "checkbox"); if (isChecked) { writer.AddAttribute(HtmlTextWriterAttribute.Checked, "checked"); } writer.AddAttribute(HtmlTextWriterAttribute.Id, id); writer.RenderBeginTag(HtmlTextWriterTag.Input); writer.RenderEndTag(); //INPUT writer.AddAttribute(HtmlTextWriterAttribute.For, id); writer.AddStyleAttribute(HtmlTextWriterStyle.FontWeight, "bold"); writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, fontSize); writer.RenderBeginTag(HtmlTextWriterTag.Label); writer.Write(name); writer.RenderEndTag(); //LABEL }