Skip to content

Commit

Permalink
Updating .NET test framework to allow hiding test web server command …
Browse files Browse the repository at this point in the history
…window
  • Loading branch information
jimevans committed Jul 10, 2019
1 parent b52106b commit 6275e4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion dotnet/test/common/Environment/EnvironmentManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ private EnvironmentManager()
TestEnvironment env = JsonConvert.DeserializeObject<TestEnvironment>(content);

bool captureWebServerOutput = TestContext.Parameters.Get<bool>("CaptureWebServerOutput", false);
bool hideWebServerCommandPrompt = TestContext.Parameters.Get<bool>("HideWebServerCommandPrompt", true);
string activeDriverConfig = TestContext.Parameters.Get("ActiveDriverConfig", env.ActiveDriverConfig);
string activeWebsiteConfig = TestContext.Parameters.Get("ActiveWebsiteConfig", env.ActiveWebsiteConfig);
string driverServiceLocation = TestContext.Parameters.Get("DriverServiceLocation", env.DriverServiceLocation);
Expand Down Expand Up @@ -107,7 +108,7 @@ private EnvironmentManager()
projectRoot += "/selenium";
}

webServer = new TestWebServer(projectRoot, captureWebServerOutput);
webServer = new TestWebServer(projectRoot, captureWebServerOutput, hideWebServerCommandPrompt);
bool autoStartRemoteServer = false;
if (browser == Browser.Remote)
{
Expand Down
7 changes: 5 additions & 2 deletions dotnet/test/common/Environment/TestWebServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ public class TestWebServer
private string standaloneTestJar = @"java/client/test/org/openqa/selenium/environment/appserver_deploy.jar";
private string projectRootPath;
private bool captureWebServerOutput;
private bool hideCommandPrompt;

private StringBuilder outputData = new StringBuilder();

public TestWebServer(string projectRoot, bool captureWebServerOutput)
public TestWebServer(string projectRoot, bool captureWebServerOutput, bool hideCommandPrompt)
{
projectRootPath = projectRoot;
this.captureWebServerOutput = captureWebServerOutput;
this.hideCommandPrompt = hideCommandPrompt;
}

public void Start()
Expand Down Expand Up @@ -70,11 +72,12 @@ public void Start()
webserverProcess.StartInfo.FileName = javaExecutableName;
webserverProcess.StartInfo.Arguments = processArgsBuilder.ToString();
webserverProcess.StartInfo.WorkingDirectory = projectRootPath;
webserverProcess.StartInfo.UseShellExecute = !(hideCommandPrompt || captureWebServerOutput);
webserverProcess.StartInfo.CreateNoWindow = hideCommandPrompt;
if (captureWebServerOutput)
{
webserverProcess.StartInfo.RedirectStandardOutput = true;
webserverProcess.StartInfo.RedirectStandardError = true;
webserverProcess.StartInfo.UseShellExecute = false;
}

webserverProcess.Start();
Expand Down

0 comments on commit 6275e4e

Please sign in to comment.