/// <summary> /// Loads settings from query string /// </summary> public void LoadFromQueryString(NameValueCollection querystring) { this.Tag = querystring["tag"]; bool hasTag = !String.IsNullOrEmpty(Tag); bool run = false; bool.TryParse(querystring["run"], out run); this.Run = run; bool filter = false; bool.TryParse(querystring["filter"], out filter); this.Filter = filter; bool skipfail = false; if (bool.TryParse(querystring["skipfail"], out skipfail) && skipfail) { Tag = hasTag ? string.Format("({0})-Fail", Tag) : "!Fail"; } this.SkipFail = skipfail; this.LogDetail = WebTestLogDetail.Default; bool concise = false; if (bool.TryParse(querystring["concise"], out concise) && concise) { this.LogDetail = WebTestLogDetail.Concise; } bool verbose = false; if (bool.TryParse(querystring["verbose"], out verbose) && verbose) { this.LogDetail = WebTestLogDetail.Verbose; } bool writeLog = false; bool.TryParse(querystring["log"], out writeLog); this.WriteLog = writeLog; bool showConsole = true; if (querystring.AllKeys.Contains("console")) { bool.TryParse(querystring["console"], out showConsole); } this.ShowConsole = showConsole; }
internal void OnLoadCompleteInternal() { // Only auto-select or auto-run on the first request if (!_aspNetService.GetIsPostBack(this)) { // Get query string values QueryStringParameters queryParams = new QueryStringParameters(); queryParams.LoadFromQueryString(_aspNetService.GetQueryString(this)); BrowserVersions browser = BrowserUtility.GetBrowser(_aspNetService.GetBrowserName(this), _aspNetService.GetBrowserMajorVersion(this)); LogDetail = queryParams.LogDetail; this.WriteLogToDiskCheckBox.Checked = queryParams.WriteLog; this.ShowConsoleCheckBox.Checked = queryParams.ShowConsole; // Auto-select tests with a given tag if (!String.IsNullOrEmpty(queryParams.Tag)) { _testcaseManager.SelectTaggedTests(this.TestCasesTreeView, queryParams.Tag, browser); } else if (queryParams.Run) { _testcaseManager.SelectAllTests(this.TestCasesTreeView, browser); } // Optionally remove unselected tests if (queryParams.Filter) { _testcaseManager.FilterIgnoredTests(this.TestCasesTreeView); } // Auto-run the selected tests (or all tests if none are selected) if (queryParams.Run) { RunTestCases(); } } // Change UI depending if showing console or not. if (this.ShowConsoleCheckBox.Checked) { this.TestsPanel.CssClass = "tests"; this.FooterPanel.Visible = true; } else { this.TestsPanel.CssClass = "testsNoConsole"; this.FooterPanel.Visible = false; } }
public QueryStringParameters() { LogDetail = WebTestLogDetail.Default; ShowConsole = true; }