Example #1
0
 public virtual void Dispose()
 {
     this.explorer      = null;
     this.fixtureRunner = null;
     if (this.resolver != null)
     {
         this.resolver.Dispose();
         this.resolver = null;
     }
     this.report       = null;
     this.testAssembly = null;
 }
Example #2
0
 public virtual void Clear()
 {
     if (this.Explorer != null)
     {
         this.Explorer.FixtureGraph.Clear();
     }
     if (this.report != null)
     {
         this.report.Clear();
     }
     this.report       = null;
     this.testAssembly = null;
 }
            public TestResult Run()
            {
                assemblyTestOutcome = TestOutcome.Passed;

                if (assemblyTestCommand != null)
                {
                    ReportListener reportListener = new ReportListener();
                    Run(fixtureExplorer, reportListener);

                    // TODO: Do we need to do anyhing with the result in the report listener?
                }

                return(assemblyTestResult ?? new TestResult(TestOutcome.Error));
            }
Example #4
0
        public void AddEventListener(IServiceCollection services)
        {
            var listeners = this.Configuration.GetSection("listener").Get <List <ListenerItem> >();
            Dictionary <string, ListenerItem> dict = new Dictionary <string, ListenerItem>();

            if (listeners != null)
            {
                foreach (var item in listeners)
                {
                    dict.Add(item.Name, item);
                }
            }
            var report = new ReportListener(dict);

            services.AddSingleton <ReportListener>(report);
        }
        public ExtendedScreenshot Invoke(ExtendedScreenshot LatestScreenshot)
        {
            try
            {
                LatestScreenshot = new ExtendedScreenshot(this.Method, this.SolidGlass);
                Program.History.Add(LatestScreenshot);
                Program.Preview.GroomBackForwardIcons();
            }
            catch (Exception e)
            {
                Trace.WriteLine(string.Format("Exception in TakeForegroundScreenshot: {0}", e.GetBaseException()), string.Format("Program.DoActionItem [{0}]", System.Threading.Thread.CurrentThread.Name));

                ReportListener reporter = Trace.Listeners.Cast <TraceListener>().Where(tl => tl is ReportListener).FirstOrDefault() as ReportListener;
                File.WriteAllText(Path.Combine(Configuration.LocalPath, "report.txt"), string.Join("\n", reporter.Messages.Select(m => string.Format("{0} {1}: {2}", m.Timestamp, m.Category, m.Message)).ToArray()));
            }

            return(LatestScreenshot);
        }
Example #6
0
        public void ShouldProduceValidXmlDocument()
        {
            XDocument actual   = null;
            var       listener = new ReportListener(report => actual = report);

            using (var console = new RedirectedConsole())
            {
                Run(listener);

                console.Lines()
                .ShouldEqual(
                    "Console.Out: Fail",
                    "Console.Error: Fail",
                    "Console.Out: FailByAssertion",
                    "Console.Error: FailByAssertion",
                    "Console.Out: Pass",
                    "Console.Error: Pass");
            }

            CleanBrittleValues(actual.ToString(SaveOptions.DisableFormatting)).ShouldEqual(ExpectedReport);
        }
Example #7
0
 public RemoteTestEngine(IFixtureRunner fixtureRunner)
 {
     this.SetFixtureRunner(fixtureRunner);
     this.report   = new ReportListener();
     this.resolver = new AssemblyResolverManager();
 }
Example #8
0
        public virtual void Run(
            FixtureExplorer explorer,
            ReportListener reportListener
            )
        {
            if (explorer == null)
            {
                throw new ArgumentNullException("explorer");
            }
            if (reportListener == null)
            {
                throw new ArgumentNullException("reportListener");
            }

            this.explorer     = explorer;
            this.report       = reportListener;
            this.abortPending = false;

            try
            {
                // start reporting
                this.Report.StartTests();

                if (this.IsAbortPending)
                {
                    return;
                }

                // assembly setup
                if (!this.RunAssemblySetUp())
                {
                    return;
                }

                if (this.IsAbortPending)
                {
                    return;
                }

                try
                {
                    RunFixtures();
                }
                finally
                {
                    this.RunAssemblyTearDown();
                }
            }
            catch (Exception ex)
            {
                ReportException          rex  = ReportException.FromException(ex);
                ReportExceptionException rexe = new ReportExceptionException(
                    "Internal error while running tests in " +
                    this.Explorer.AssemblyName, rex);
                throw rexe;
            }
            finally
            {
                this.Report.FinishTests();

                this.explorer = null;
                this.report   = null;
            }
        }
Example #9
0
 static Action <XDocument> SaveReport(Options options)
 {
     return(report => ReportListener.Save(report, FullPath(options.Report)));
 }
            public TestResult Run()
            {
                assemblyTestOutcome = TestOutcome.Passed;

                if (assemblyTestCommand != null)
                {
                    ReportListener reportListener = new ReportListener();
                    Run(fixtureExplorer, reportListener);

                    // TODO: Do we need to do anyhing with the result in the report listener?
                }

                return assemblyTestResult ?? new TestResult(TestOutcome.Error);
            }