public void RunTest(RunTests instruction, TestResultReporter reporter) { var name = new AssemblyName(instruction.AssemblyName); var assembly = Assembly.Load(name); try { var discoverer = new TestDiscoverer(); discoverer.Load(assembly, instruction.Source); WrapRun(instruction, reporter, discoverer, assembly); } catch (Exception ex) { reporter.AddResult(new TestResult(instruction.TestCases[0]) { ErrorStackTrace = ex.StackTrace, ErrorMessage = ex.Message, Result = TestOutcome.Failed, }); } }
static async Task Main(string[] args) { var discoverer = new TestDiscoverer(); discoverer.Load(new[] { typeof(IncidentWrapper).Assembly }); var runner = new TestRunner(discoverer); runner.Load(new[] { typeof(IncidentWrapper).Assembly }).GetAwaiter().GetResult(); var result = runner.RunAll().GetAwaiter().GetResult(); var faulty = result.Where(x => !x.IsSuccess).ToList(); var cmd = new RunTests { AssemblyName = typeof(EnvironmentTests).Assembly.GetName().Name, AssemblyPath = Path.GetDirectoryName(typeof(EnvironmentTests).Assembly.Location), //TestCases = new[] //{ // new TestCaseToRun("Coderr.IntegrationTests.Core.TestCases.EnvironmentTests.Clearing_environment_should_remove_all_incidents_in_it") // { // TestClassName = "EnvironmentTests", // TestMethodName = "Clearing_environment_should_remove_all_incidents_in_it" // }, //}, Source = typeof(EnvironmentTests).Assembly.Location }; var receiver = new ConsoleReceiver(); using (var coordinator = new AppDomainRunner("TesTSuite1")) { coordinator.Create(); coordinator.AddDirectory( @"C:\src\1tcompany\coderr\oss\Coderr.Server\src\Tools\Coderr.IntegrationTests\Coderr.IntegrationTests\bin\Debug\net461"); coordinator.RunTests(cmd, receiver); } }