// The Adapter is constructed using the default constructor. // We don't have any info to initialize it until one of the // ITestDiscovery or ITestExecutor methods is called. The // each Discover or Execute method must call this method. protected virtual void Initialize(IMessageLogger messageLogger) { Verbosity = 0; // In case we throw below AdapterVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); try { var registry = RegistryCurrentUser.OpenRegistryCurrentUser(@"Software\nunit.org\VSAdapter"); UseVsKeepEngineRunning = registry.Exist("UseVsKeepEngineRunning") && (registry.Read <int>("UseVsKeepEngineRunning") == 1); ShadowCopy = registry.Exist("ShadowCopy") && (registry.Read <int>("ShadowCopy") == 1); #if DEBUG && VERBOSE Verbosity = 1; #else Verbosity = (registry.Exist("Verbosity")) ? registry.Read <int>("Verbosity") : 0; #endif } catch (Exception e) { messageLogger.SendMessage(TestMessageLevel.Error, "Unable to access registry. Default settings will be used"); messageLogger.SendMessage(TestMessageLevel.Error, e.ToString()); } TestEngine = new TestEngine(); TestLog = new TestLogger(messageLogger, Verbosity); }
protected void Unload() { if (TestEngine != null) { TestEngine.Dispose(); TestEngine = null; } if (_engineDomain != null) { AppDomain.Unload(_engineDomain); _engineDomain = null; } }
// The Adapter is constructed using the default constructor. // We don't have any info to initialize it until one of the // ITestDiscovery or ITestExecutor methods is called. The // each Discover or Execute method must call this method. protected void Initialize(IDiscoveryContext context, IMessageLogger messageLogger) { TestEngine = new TestEngineClass(); TestLog = new TestLogger(messageLogger, Settings.Verbosity); try { Settings.Load(context); } catch (Exception e) { TestLog.Error("Error initializing RunSettings. Default settings will be used"); TestLog.Error(e.ToString()); } }
public EngineTestRunner() { engine = new TestEngineClass(); engine.Services.Add(new SettingsService(false)); // Might not be required. engine.Services.Add(new ExtensionService()); engine.Services.Add(new InProcessTestRunnerFactory()); engine.Services.Add(new DriverService()); engine.Services.Add(new TestFilterService()); engine.Services.Add(new ProjectService()); engine.Services.Add(new RuntimeFrameworkService()); engine.Services.ServiceManager.StartServices(); }
protected ITestRunner GetRunnerFor(string assemblyName) { var package = new TestPackage(assemblyName); if (ShadowCopy) { package.Settings["ShadowCopyFiles"] = "true"; TestLog.SendDebugMessage(" Setting ShadowCopyFiles to true"); } if (Debugger.IsAttached) { package.Settings["NumberOfTestWorkers"] = 0; TestLog.SendDebugMessage(" Setting NumberOfTestWorkers to zero"); } // Lastest version defaults to a separate process package.Settings["ProcessModel"] = "InProcess"; package.Settings["DomainUsage"] = "Single"; return(TestEngine.GetRunner(package)); }
// The Adapter is constructed using the default constructor. // We don't have any info to initialize it until one of the // ITestDiscovery or ITestExecutor methods is called. The // each Discover or Execute method must call this method. protected virtual void Initialize(IMessageLogger messageLogger) { Verbosity = 0; // In case we throw below AdapterVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); try { var registry = RegistryCurrentUser.OpenRegistryCurrentUser(@"Software\nunit.org\VSAdapter"); UseVsKeepEngineRunning = registry.Exist("UseVsKeepEngineRunning") && (registry.Read<int>("UseVsKeepEngineRunning") == 1); ShadowCopy = registry.Exist("ShadowCopy") && (registry.Read<int>("ShadowCopy") == 1); #if DEBUG && VERBOSE Verbosity = 1; #else Verbosity = (registry.Exist("Verbosity")) ? registry.Read<int>("Verbosity") : 0; #endif } catch (Exception e) { messageLogger.SendMessage(TestMessageLevel.Error, "Unable to access registry. Default settings will be used"); messageLogger.SendMessage(TestMessageLevel.Error, e.ToString()); } TestEngine = new TestEngine(); TestLog = new TestLogger(messageLogger, Verbosity); }