namespace Recordingtest.Runner;
public static class Program
{
public static int Main(string[] args)
{
var options = new RunnerOptions();
string? sidecarUrl = null;
bool noSidecar = false;
for (int i = 0; i < args.Length; i++)
{
switch (args[i])
{
case "--scenarios": options.ScenariosDir = args[++i]; break;
case "--baselines": options.BaselinesDir = args[++i]; break;
case "--out": options.OutDir = args[++i]; break;
case "--profile": options.Profile = args[++i]; break;
case "--no-launch": options.NoLaunch = true; break;
case "--sidecar-url": sidecarUrl = args[++i]; break;
case "--no-sidecar": noSidecar = true; break;
case "--sidecar-profile": options.SidecarProfile = args[++i]; break;
case "--scenario": options.ScenarioFilter = args[++i]; break;
case "-h":
case "--help":
Console.WriteLine("Usage: Recordingtest.Runner --scenarios
--baselines --out ");
Console.WriteLine(" [--profile ] [--no-launch]");
Console.WriteLine(" [--sidecar-url http://localhost:38080] [--no-sidecar]");
Console.WriteLine(" [--sidecar-profile engine-state]");
Console.WriteLine(" [--scenario ] (run only this scenario)");
return 0;
}
}
if (string.IsNullOrEmpty(options.ScenariosDir) ||
string.IsNullOrEmpty(options.BaselinesDir) ||
string.IsNullOrEmpty(options.OutDir))
{
Console.Error.WriteLine("Missing required args. Use --help.");
return 2;
}
// engine-bridge v3 — default to the well-known localhost bridge port
// unless the caller explicitly opts out or overrides the URL.
IEngineStateSnapshotClient? sidecar = null;
if (!noSidecar)
{
sidecar = new HttpEngineStateSnapshotClient(
sidecarUrl ?? HttpEngineStateSnapshotClient.DefaultBaseUrl);
}
var runner = new TestRunner();
var report = runner.RunAll(
options,
new DefaultHostFactory(),
new DefaultNormalizer(),
new DefaultDiffer(),
sidecarClient: sidecar);
(sidecar as IDisposable)?.Dispose();
Console.WriteLine($"Total: {report.Total}, Passed: {report.Passed}, Failed: {report.Failed}, Errored: {report.Errored}");
return TestRunner.ToExitCode(report);
}
}