예제 #1
0
 private static void GenerateReport(ITestReportWriter reportWriter)
 {
     if (reportWriter.CanGenerateReport)
     {
         Console.WriteLine("Generating report..");
         reportWriter.GenerateReport();
     }
 }
예제 #2
0
        private static void Main(string[] args)
        {
            //Console.ReadKey();
            try
            {
                _launchTime = DateTime.Now;
                _svcContext = new ServiceContext();
                CheckForHelp(args);
                string addinName          = GetAddinName(args);
                ITestFrameworkAddin addIn = (addinName == null)?new RedefineFrameworkAddin() : TestAddinManager.GetAddIn(ConfigurationManager.AppSettings[addinName]);
                addIn.RegisterServices(_svcContext);

                ValidateAddInParameters(args, addIn);
                _exitOnFail = addIn.ExitOnTestFail;

                ITestScriptProvider scriptProvider = addIn.GetScriptProvider();
                WriteHeader();
                scriptProvider.OnAfterCreateNode      += OnAfterCreateNode;
                scriptProvider.OnNotifyLoadErrors     += OnLoadErrors;
                scriptProvider.OnErrorProcessingNodes += OnErrorProcessingNodes;


                scriptProvider.LoadScripts();

                Console.WriteLine();

                WriteTestCount(scriptProvider);
                Console.WriteLine();

                Console.WriteLine("Runnning test..");
                Console.WriteLine("Add-in loaded: " + addIn.AddinName);
                Console.WriteLine();
                addIn.GetTestEngine().OnTestComplete        += OnTestComplete;
                addIn.GetTestEngine().OnNotifyTestRunErrors += OnNotifyTestRunErrors;
                addIn.Run();

                ITestReportWriter reportWriter = addIn.GetReportWriter();
                GenerateReport(reportWriter);
                Console.WriteLine();
                WriteSummaryTestResult(addIn.TestedItems);
            }
            finally
            {
                ConsoleText.SetColor(ConsoleText.DEFAULT_COLOR);
            }
        }