Esempio n. 1
0
        public ReportCounter GetCounter()
        {
            ReportCounter counter = new ReportCounter();

            counter.RunCount = this.Starters.Count;
            foreach (RunPipeStarter starter in this.Starters)
            {
                if (starter.HasResult)
                {
                    switch (starter.Result.Result)
                    {
                    case ReportRunResult.Success:
                        ++counter.SuccessCount;
                        break;

                    case ReportRunResult.Failure:
                        ++counter.FailureCount;
                        break;

                    case ReportRunResult.Ignore:
                        ++counter.IgnoreCount;
                        break;
                    }
                }
            }
            return(counter);
        }
Esempio n. 2
0
        public void LoadAndRunFixtures()
        {
            this.CreateAssembly();

            // load assembly
            using (TestDomain domain = new TestDomain(this.compiler.Parameters.OutputAssembly))
            {
                domain.ShadowCopyFiles = false;
                domain.InitializeEngine();
                foreach (string dir in this.Compiler.Parameters.ReferencedAssemblies)
                {
                    domain.TestEngine.AddHintDirectory(dir);
                }
                domain.PopulateEngine();
                Console.WriteLine("Domain loaded");
                Console.WriteLine("Tree populated, {0} tests", domain.TestEngine.GetTestCount());
                // Assert.AreEqual(1, domain.TestTree.GetTestCount());
                // domain.TestTree.Success+=new MbUnit.Core.RunSuccessEventHandler(TestTree_Success);
                // running tests
                domain.TestEngine.RunPipes();

                // display report
                TextReport report = new TextReport();
                result = domain.TestEngine.Report.Result;
                report.Render(result, Console.Out);
                counter = domain.TestEngine.GetTestCount();
            }
        }
Esempio n. 3
0
		public void ResetTests()
		{
			this.Counter.Clear();
			if (this.tree!=null)
			{
				this.counter = this.Tree.TestDomains.GetTestCount();
			}
		}
Esempio n. 4
0
        public ReportCounter GetCounter()
        {
            ReportCounter counter = new ReportCounter();

            foreach (FixtureVertex v in this.graph.Vertices)
            {
                counter.AddCounts(v.Fixtures.GetCounter());
            }
            return(counter);
        }
Esempio n. 5
0
        public ReportCounter GetCounter()
        {
            ReportCounter counter = new ReportCounter();

            foreach (Fixture fixture in this)
            {
                counter.AddCounts(fixture.GetCounter());
            }
            return(counter);
        }
        public ReportCounter GetTestCount()
        {
            ReportCounter count = new ReportCounter();;

            foreach (TreeTestDomain domain in this.list)
            {
                if (domain.TestEngine == null)
                {
                    continue;
                }
                count.AddCounts(domain.TestEngine.GetTestCount());
            }
            return(count);
        }
Esempio n. 7
0
        public ReportResult RunTests()
        {
            ReportResult result = new ReportResult();

            if (graph.VerticesCount == 0)
            {
                this.OnLog("No assembly to execute");
                result.UpdateCounts();
                return(result);
            }

            this.OnLog("Sorting assemblies by dependencies");
            // create topological sort
            ArrayList sortedVertices      = new ArrayList();
            TopologicalSortAlgorithm topo = new TopologicalSortAlgorithm(graph);

            topo.Compute(sortedVertices);
            if (sortedVertices.Count == 0)
            {
                throw new InvalidOperationException("Cannot be zero");
            }

            // set vertices colors
            this.OnLog("Setting up fixture colors");
            VertexColorDictionary colors = new VertexColorDictionary();

            foreach (TestDomainVertex v in graph.Vertices)
            {
                colors.Add(v, GraphColor.White);
            }

            // execute each domain
            foreach (TestDomainVertex v in sortedVertices)
            {
                // if vertex color is not white, skip it
                GraphColor color = colors[v];
                if (color != GraphColor.White)
                {
                    this.OnLog("Skipping assembly {0} because dependent assembly failed", v.Domain.TestEngine.Explorer.AssemblyName);
                    // mark children
                    foreach (TestDomainVertex child in graph.AdjacentVertices(v))
                    {
                        colors[child] = GraphColor.Black;
                    }
                    continue;
                }

                this.OnLog("Loading {0}", v.Domain.TestEngine.Explorer.AssemblyName);

                ReportCounter counter = v.Domain.TestEngine.GetTestCount();
                this.OnLog("Found  {0} tests", counter.RunCount);
                this.OnLog("Running fixtures.");
                v.Domain.TestEngine.RunPipes();
                counter = v.Domain.TestEngine.GetTestCount();
                this.OnLog("Tests finished: {0} tests, {1} success, {2} failures, {3} ignored"
                           , counter.RunCount
                           , counter.SuccessCount
                           , counter.FailureCount
                           , counter.IgnoreCount
                           );

                result.Merge(v.Domain.TestEngine.Report.Result);

                if (counter.FailureCount != 0)
                {
                    // mark children as failed
                    colors[v] = GraphColor.Black;
                    foreach (TestDomainVertex child in graph.AdjacentVertices(v))
                    {
                        colors[child] = GraphColor.Black;
                    }
                }
                else
                {
                    // mark vertex as succesfull
                    colors[v] = GraphColor.Gray;
                }
            }

            result.UpdateCounts();
            MbUnit.Framework.Assert.IsNotNull(result);
            MbUnit.Framework.Assert.IsNotNull(result.Counter);

            this.OnLog("All Tests finished: {0} tests, {1} success, {2} failures, {3} ignored in {4} seconds"
                       , result.Counter.RunCount
                       , result.Counter.SuccessCount
                       , result.Counter.FailureCount
                       , result.Counter.IgnoreCount
                       , result.Counter.Duration
                       );

            return(result);
        }