public void ParseVS10SampleFile() { TrxParser parser = new TrxParser(); var result = parser.Parse("VS2010.trx.xml"); Assert.AreEqual("Sample", result.Name); Assert.AreEqual(1, result.Computers.Count()); Assert.AreEqual("RIDOHP", result.Computers.First()); Assert.AreEqual(@"RIDOHP\rido", result.UserName); Assert.AreEqual(18, result.TestMethodRunList.Count(), "No se ha calculado el número total de TestMethods"); Assert.AreEqual(18, result.TotalMethods, "No se ha calculado el número total de TestMethods"); Assert.AreEqual(6,result.Passed, "No se ha calculado el número total de TestMethods OK"); Assert.AreEqual(7, result.Failed, "No se ha calculado el número total de TestMethods Failed"); Assert.AreEqual(5, result.Inconclusive, "No se ha calculado el número total de TestMethods Ignored"); Assert.AreEqual(1, result.Assemblies.Count()); Assert.AreEqual("SampleReport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", result.Assemblies.First().FullName); Assert.AreEqual(TimeSpan.Parse("00:00:00.0537262"), result.TimeTaken); Assert.AreEqual(33, result.PercentOK, "no se ha calculado el PercentOK"); Assert.AreEqual(39, result.PercentKO, "no se ha calculado el PercentKO"); Assert.AreEqual(28, result.PercentIgnored, "no se ha calculado el PercentIgnored"); Assert.AreEqual(56, result.TotalPercent); Assert.AreEqual(6, result.TestClassList.Count); AssertAllFailed(result); AssertSomeFailed(result); AssertAllPassed(result); AssertFailAndIgnored(result); }
public void GroupedByStatus() { TrxParser parser = new TrxParser(); var result = parser.Parse("VS2010.trx.xml"); var grouped = result.TestMethodRunList.GroupBy(c => c.Status); Assert.AreEqual(4, grouped.Count()); var group = grouped.ElementAt(0); Assert.AreEqual(1, group.Count()); }
public void CanParseNotRunnable() { TrxParser parser = new TrxParser(); var result = parser.Parse("NotRunnable.trx.xml"); Assert.IsNotNull(result); Assert.AreEqual(0, result.PercentOK); Assert.AreEqual(0, result.PercentKO); Assert.AreEqual(100, result.PercentIgnored); Assert.AreEqual(1, result.Inconclusive); }
public void CreateHtmlFile() { TrxParser parser = new TrxParser(); var result = parser.Parse("VS2010.trx.xml"); HtmlConverter html = new HtmlConverter(result); string fileName = Path.Combine(System.Environment.CurrentDirectory, @"newTrx2Html.html"); using (TextWriter file = File.CreateText(fileName)) { file.Write(html.GetHtml()); } Process.Start("IExplore.exe", fileName); }
internal static void GenerateReport(string fileName) { VersionFinder v = new VersionFinder(); SupportedFormats f = v.GetFileVersion(fileName); if (f != SupportedFormats.vs2010) { Console.WriteLine("File {0} is not a recognized as a valid trx. Only VS2010 are supported", fileName); } else { Console.WriteLine("Processing {0} trx file", f.ToString()); TrxParser parser = new TrxParser(); TestRunResult r = parser.Parse(fileName); string html = new HtmlConverter(r).GetHtml(); using (TextWriter file = File.CreateText(fileName + ".htm")) { file.Write(html); } Console.WriteLine("Tranformation Succeed. OutputFile: " + fileName + ".htm\n"); } }