[dotnet] allow toggling test values by environment variable
using System.IO;
using Newtonsoft.Json;
using NUnit.Framework;
-using System.Collections.Generic;
namespace OpenQA.Selenium.Environment
{
@@ -28,15 +27,16 @@ private EnvironmentManager()
string content = File.ReadAllText(configFile);
TestEnvironment env = JsonConvert.DeserializeObject<TestEnvironment>(content);
- string activeDriverConfig = TestContext.Parameters.Get("ActiveDriverConfig", env.ActiveDriverConfig);
+ string activeDriverConfig = System.Environment.GetEnvironmentVariable("ACTIVE_DRIVER_CONFIG") ?? TestContext.Parameters.Get("ActiveDriverConfig", env.ActiveDriverConfig);
+ string driverServiceLocation = System.Environment.GetEnvironmentVariable("DRIVER_SERVICE_LOCATION") ?? TestContext.Parameters.Get("DriverServiceLocation", env.DriverServiceLocation);
string activeWebsiteConfig = TestContext.Parameters.Get("ActiveWebsiteConfig", env.ActiveWebsiteConfig);
- string driverServiceLocation = TestContext.Parameters.Get("DriverServiceLocation", env.DriverServiceLocation);
DriverConfig driverConfig = env.DriverConfigs[activeDriverConfig];
WebsiteConfig websiteConfig = env.WebSiteConfigs[activeWebsiteConfig];
TestWebServerConfig webServerConfig = env.TestWebServerConfig;
webServerConfig.CaptureConsoleOutput = TestContext.Parameters.Get<bool>("CaptureWebServerOutput", env.TestWebServerConfig.CaptureConsoleOutput);
webServerConfig.HideCommandPromptWindow = TestContext.Parameters.Get<bool>("HideWebServerCommandPrompt", env.TestWebServerConfig.HideCommandPromptWindow);
webServerConfig.JavaHomeDirectory = TestContext.Parameters.Get("WebServerJavaHome", env.TestWebServerConfig.JavaHomeDirectory);
+
this.driverFactory = new DriverFactory(driverServiceLocation);
this.driverFactory.DriverStarting += OnDriverStarting;
