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("etting 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; }