diff --git a/ContinuousTests/ContinuousTestRunner.cs b/ContinuousTests/ContinuousTestRunner.cs index a2522aa..e6acb17 100644 --- a/ContinuousTests/ContinuousTestRunner.cs +++ b/ContinuousTests/ContinuousTestRunner.cs @@ -1,4 +1,6 @@ -namespace ContinuousTests +using Logging; + +namespace ContinuousTests { public class ContinuousTestRunner { @@ -17,8 +19,9 @@ { startupChecker.Check(); + var overviewLog = new FixtureLog(new LogConfig(config.LogPath, false), "Overview"); var allTests = testFactory.CreateTests(); - var testStarters = allTests.Select(t => new TestStarter(config, t.GetType(), t.RunTestEvery)).ToArray(); + var testStarters = allTests.Select(t => new TestStarter(config, overviewLog, t.GetType(), t.RunTestEvery)).ToArray(); foreach (var t in testStarters) { diff --git a/ContinuousTests/SingleTestRun.cs b/ContinuousTests/SingleTestRun.cs index 8e384d3..75e12e1 100644 --- a/ContinuousTests/SingleTestRun.cs +++ b/ContinuousTests/SingleTestRun.cs @@ -11,15 +11,17 @@ namespace ContinuousTests private readonly CodexNodeFactory codexNodeFactory = new CodexNodeFactory(); private readonly List exceptions = new List(); private readonly Configuration config; + private readonly BaseLog overviewLog; private readonly TestHandle handle; private readonly CodexNode[] nodes; private readonly FileManager fileManager; private readonly FixtureLog fixtureLog; private readonly string dataFolder; - public SingleTestRun(Configuration config, TestHandle handle) + public SingleTestRun(Configuration config, BaseLog overviewLog, TestHandle handle) { this.config = config; + this.overviewLog = overviewLog; this.handle = handle; var testName = handle.Test.GetType().Name; @@ -76,10 +78,11 @@ namespace ContinuousTests { if (exceptions.Any()) { - Log(" > Completed last test moment. Test failed."); - throw exceptions.First(); + var ex = exceptions.First(); + OverviewLog(" > Test failed: " + ex); + throw ex; } - Log(" > Completed last test moment. Test passed."); + OverviewLog(" > Test passed."); return; } } @@ -116,6 +119,12 @@ namespace ContinuousTests fixtureLog.Log(msg); } + private void OverviewLog(string msg) + { + Log(msg); + overviewLog.Log(msg); + } + private CodexNode[] CreateRandomNodes(int number) { var containers = SelectRandomContainers(number); diff --git a/ContinuousTests/TestStarter.cs b/ContinuousTests/TestStarter.cs index 68deb9a..6253f64 100644 --- a/ContinuousTests/TestStarter.cs +++ b/ContinuousTests/TestStarter.cs @@ -1,14 +1,18 @@ -namespace ContinuousTests +using Logging; + +namespace ContinuousTests { public class TestStarter { private readonly Configuration config; + private readonly BaseLog overviewLog; private readonly Type testType; private readonly TimeSpan runsEvery; - public TestStarter(Configuration config, Type testType, TimeSpan runsEvery) + public TestStarter(Configuration config, BaseLog overviewLog, Type testType, TimeSpan runsEvery) { this.config = config; + this.overviewLog = overviewLog; this.testType = testType; this.runsEvery = runsEvery; } @@ -29,7 +33,7 @@ { var test = (ContinuousTest)Activator.CreateInstance(testType)!; var handle = new TestHandle(test); - var run = new SingleTestRun(config, handle); + var run = new SingleTestRun(config, overviewLog, handle); run.Run(); } }