Пример #1
0
        private void GenerateReports(ITestListener testListener, Assembly assembly, ReportResult result)
        {
            try
            {
                string outputPath = GetAppDataPath("");
                string nameFormat = assembly.GetName().Name + ".Tests";

                string file = HtmlReport.RenderToHtml(result, outputPath, nameFormat);

                if (file != "")
                {
                    Uri uri = new Uri("file:" + Path.GetFullPath(file).Replace("\\", "/"));
                    testListener.TestResultsUrl(uri.AbsoluteUri);
                }
                else
                {
                    testListener.WriteLine("Skipping report generation", Category.Info);
                }
            }
            catch (Exception ex)
            {
                testListener.WriteLine("failed to create reports", Category.Error);
                testListener.WriteLine(ex.ToString(), Category.Error);
            }
        }
Пример #2
0
        public void TestResultsUrl(string url)
        {
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }

            try
            {
                testListener.TestResultsUrl(url);
            }
            catch (Exception ex)
            {
                throw ServerExceptionUtils.Wrap(ex);
            }
        }
Пример #3
0
        private void GenerateReports(ITestListener testListener, Assembly assembly,ReportResult result)
        {
            try
            {
                string outputPath = GetAppDataPath("");
                string nameFormat = assembly.GetName().Name + ".Tests";

                string file = HtmlReport.RenderToHtml(result, outputPath, nameFormat);

                if (file != "")
                {
                    Uri uri = new Uri("file:" + Path.GetFullPath(file).Replace("\\", "/"));
                    testListener.TestResultsUrl(uri.AbsoluteUri);
                }
                else
                {
                    testListener.WriteLine("Skipping report generation", Category.Info);
                }
            }
            catch (Exception ex)
            {
                testListener.WriteLine("failed to create reports",Category.Error);
                testListener.WriteLine(ex.ToString(), Category.Error);
            }
        }