2
0
mirror of synced 2025-02-05 13:15:10 +00:00
cs-codex-dist-tests/ContinuousTests/ContinuousTestRunner.cs

39 lines
1.2 KiB
C#
Raw Normal View History

2023-06-25 11:06:47 +02:00
using Logging;
namespace ContinuousTests
{
2023-06-25 09:53:10 +02:00
public class ContinuousTestRunner
{
private readonly ConfigLoader configLoader = new ConfigLoader();
private readonly TestFactory testFactory = new TestFactory();
2023-06-25 09:53:10 +02:00
private readonly Configuration config;
private readonly StartupChecker startupChecker;
2023-06-26 14:44:21 +02:00
public ContinuousTestRunner(string[] args)
{
2023-06-26 14:44:21 +02:00
config = configLoader.Load(args);
2023-06-25 09:53:10 +02:00
startupChecker = new StartupChecker(config);
}
2023-06-25 09:53:10 +02:00
public void Run()
{
2023-06-25 09:53:10 +02:00
startupChecker.Check();
2023-06-25 11:06:47 +02:00
var overviewLog = new FixtureLog(new LogConfig(config.LogPath, false), "Overview");
2023-06-27 10:16:59 +02:00
overviewLog.Log("Continuous tests starting...");
2023-06-25 09:53:10 +02:00
var allTests = testFactory.CreateTests();
2023-06-27 10:16:59 +02:00
var testLoop = allTests.Select(t => new TestLoop(config, overviewLog, t.GetType(), t.RunTestEvery)).ToArray();
2023-06-27 10:16:59 +02:00
foreach (var t in testLoop)
{
2023-06-27 10:16:59 +02:00
overviewLog.Log("Launching test-loop for " + t.Name);
2023-06-25 09:53:10 +02:00
t.Begin();
Thread.Sleep(TimeSpan.FromMinutes(5));
}
2023-06-27 10:16:59 +02:00
overviewLog.Log("All test-loops launched.");
2023-06-25 10:50:01 +02:00
while (true) Thread.Sleep((2 ^ 31) - 1);
}
}
}