//Exposed for testing internal ITestEngineRunner GetEngineRunner() { if (_engineRunner == null) { // Expand any project subpackages _packageAnalyzer.ExpandProjectPackages(TestPackage); // Add package settings to reflect the target runtime // and test framework usage of each assembly. foreach (var package in TestPackage.Select(p => p.IsAssemblyPackage())) { if (File.Exists(package.FullName)) { _packageAnalyzer.ApplyImageSettings(package); } } // Use SelectRuntimeFramework for its side effects. // Info will be left behind in the package about // each contained assembly, which will subsequently // be used to determine how to run the assembly. _runtimeService.SelectRuntimeFramework(TestPackage); _engineRunner = _testRunnerFactory.MakeTestRunner(TestPackage); } return(_engineRunner); }
public AggregatingTestRunner(IServiceLocator services, TestPackage package) : base(package) { _testRunnerFactory = services.GetService <ITestRunnerFactory>(); _packageList = new List <TestPackage>(package.Select(p => !p.HasSubPackages())); Runners = new List <ITestEngineRunner>(); foreach (var subPackage in _packageList) { Runners.Add(_testRunnerFactory.MakeTestRunner(subPackage)); } }
public MasterTestRunner(IServiceLocator services, TestPackage package) { _services = services; TestPackage = package; _testRunnerFactory = _services.GetService <ITestRunnerFactory>(); _projectService = _services.GetService <IProjectService>(); _runtimeService = _services.GetService <IRuntimeFrameworkService>(); _extensionService = _services.GetService <ExtensionService>(); _engineRunner = _testRunnerFactory.MakeTestRunner(package); }
public MasterTestRunner(IServiceLocator services, TestPackage package) { _services = services; TestPackage = package; _testRunnerFactory = _services.GetService<ITestRunnerFactory>(); _projectService = _services.GetService<IProjectService>(); _runtimeService = _services.GetService<IRuntimeFrameworkService>(); _extensionService = _services.GetService<ExtensionService>(); _engineRunner = _testRunnerFactory.MakeTestRunner(package); }
//Exposed for testing internal ITestEngineRunner GetEngineRunner() { if (_engineRunner == null) { // Expand projects and update package settings to reflect the // target runtime and test framework usage of each assembly. _packageSettingsService.UpdatePackage(TestPackage); // Use SelectRuntimeFramework for its side effects. // Info will be left behind in the package about // each contained assembly, which will subsequently // be used to determine how to run the assembly. #if !NETSTANDARD2_0 _runtimeService.SelectRuntimeFramework(TestPackage); #endif _engineRunner = _testRunnerFactory.MakeTestRunner(TestPackage); } return(_engineRunner); }
//Exposed for testing internal ITestEngineRunner GetEngineRunner() { if (_engineRunner == null) { // Some files in the top level package may be projects. // Expand them so that they contain subprojects for // each contained assembly. EnsurePackagesAreExpanded(TestPackage); // Use SelectRuntimeFramework for its side effects. // Info will be left behind in the package about // each contained assembly, which will subsequently // be used to determine how to run the assembly. #if !NETSTANDARD1_6 && !NETSTANDARD2_0 _runtimeService.SelectRuntimeFramework(TestPackage); #endif _engineRunner = _testRunnerFactory.MakeTestRunner(TestPackage); } return(_engineRunner); }
public override bool Load(TestPackage package) { this.TestRunner = factory.MakeTestRunner(package); return(base.Load(package)); }
public void LoadTest(string testName) { log.Info("Loading tests for " + Path.GetFileName(TestFileName)); long startTime = DateTime.Now.Ticks; try { events.FireTestLoading(TestFileName); TestPackage package = MakeTestPackage(testName); testRunner = factory.MakeTestRunner(package); bool loaded = testRunner.Load(package); loadedTest = testRunner.Test; loadedTestName = testName; testResult = null; reloadPending = false; if (Services.UserSettings.GetSetting("Options.TestLoader.ReloadOnChange", true)) { InstallWatcher( ); } if (loaded) { this.currentFramework = package.Settings.Contains("RuntimeFramework") ? package.Settings["RuntimeFramework"] as RuntimeFramework : RuntimeFramework.CurrentFramework; testProject.HasChangesRequiringReload = false; events.FireTestLoaded(TestFileName, loadedTest); } else { lastException = new ApplicationException(string.Format("Unable to find test {0} in assembly", testName)); events.FireTestLoadFailed(TestFileName, lastException); } } catch (FileNotFoundException exception) { log.Error("File not found", exception); lastException = exception; foreach (string assembly in TestProject.ActiveConfig.Assemblies) { if (Path.GetFileNameWithoutExtension(assembly) == exception.FileName && !PathUtils.SamePathOrUnder(testProject.ActiveConfig.BasePath, assembly)) { lastException = new ApplicationException(string.Format("Unable to load {0} because it is not located under the AppBase", exception.FileName), exception); break; } } events.FireTestLoadFailed(TestFileName, lastException); double loadTime = (double)(DateTime.Now.Ticks - startTime) / (double)TimeSpan.TicksPerSecond; log.Info("Load completed in {0} seconds", loadTime); } catch (Exception exception) { log.Error("Failed to load test", exception); lastException = exception; events.FireTestLoadFailed(TestFileName, exception); } }