2023-06-25 09:06:47 +00:00
|
|
|
|
using Logging;
|
|
|
|
|
|
|
|
|
|
namespace ContinuousTests
|
2023-06-25 07:53:10 +00:00
|
|
|
|
{
|
|
|
|
|
public class TestStarter
|
|
|
|
|
{
|
|
|
|
|
private readonly Configuration config;
|
2023-06-25 09:06:47 +00:00
|
|
|
|
private readonly BaseLog overviewLog;
|
2023-06-25 07:53:10 +00:00
|
|
|
|
private readonly Type testType;
|
|
|
|
|
private readonly TimeSpan runsEvery;
|
|
|
|
|
|
2023-06-25 09:06:47 +00:00
|
|
|
|
public TestStarter(Configuration config, BaseLog overviewLog, Type testType, TimeSpan runsEvery)
|
2023-06-25 07:53:10 +00:00
|
|
|
|
{
|
|
|
|
|
this.config = config;
|
2023-06-25 09:06:47 +00:00
|
|
|
|
this.overviewLog = overviewLog;
|
2023-06-25 07:53:10 +00:00
|
|
|
|
this.testType = testType;
|
|
|
|
|
this.runsEvery = runsEvery;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Begin()
|
|
|
|
|
{
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
StartTest();
|
|
|
|
|
Thread.Sleep(runsEvery);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void StartTest()
|
|
|
|
|
{
|
|
|
|
|
var test = (ContinuousTest)Activator.CreateInstance(testType)!;
|
|
|
|
|
var handle = new TestHandle(test);
|
2023-06-25 09:06:47 +00:00
|
|
|
|
var run = new SingleTestRun(config, overviewLog, handle);
|
2023-06-25 07:53:10 +00:00
|
|
|
|
run.Run();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|