/// <summary> /// Initializes a new instance of the <see cref="InitialViewFilters"/> class. /// </summary> /// <param name="title">The title.</param> /// <param name="suite">The suite.</param> /// <param name="id">The unique identifier.</param> /// <param name="priority">The priority.</param> /// <param name="assignedTo">The assigned automatic.</param> public TestCaseFilterManager(string title, string suite, string id, string assignedTo, string priority, TestCaseExecutionType testCaseExecutionType) : this(title, suite, id) { this.PriorityFilter = priority; this.AssignedToFilter = assignedTo; this.TestCaseExecutionType = testCaseExecutionType; }
/// <summary> /// Gets the type of the test case execution. /// </summary> /// <param name="executionTypeStr">The execution type string.</param> /// <returns></returns> public static TestCaseExecutionType GetTestCaseExecutionType(string executionTypeStr) { TestCaseExecutionType testCaseExecutionType = (TestCaseExecutionType)Enum.Parse(typeof(TestCaseExecutionType), executionTypeStr); switch (testCaseExecutionType) { case TestCaseExecutionType.All: break; case TestCaseExecutionType.Active: break; case TestCaseExecutionType.Passed: break; case TestCaseExecutionType.Failed: break; case TestCaseExecutionType.Blocked: break; default: testCaseExecutionType = TestCaseExecutionType.Active; break; } return(testCaseExecutionType); }
/// <summary> /// Sets the new execution outcome internal. /// </summary> private void SetNewExecutionOutcomeInternal(TestCaseExecutionType testCaseExecutionType) { bool shouldCommentWindowShow = RegistryManager.ReadShouldCommentWindowShow(); string comment = String.Empty; bool isCanceled = false; if (shouldCommentWindowShow && testCaseExecutionType != TestCaseExecutionType.Active) { RegistryManager.WriteTitleTitlePromtDialog(string.Empty); var dialog = new PrompDialogRichTextBoxWindow(); dialog.ShowDialog(); Task t = Task.Factory.StartNew(() => { isCanceled = RegistryManager.GetIsCanceledPromtDialog(); comment = RegistryManager.GetContentPromtDialog(); while (string.IsNullOrEmpty(comment) && !isCanceled) { } }); t.Wait(); isCanceled = RegistryManager.GetIsCanceledPromtDialog(); comment = RegistryManager.GetContentPromtDialog(); } if (!isCanceled || !shouldCommentWindowShow) { Task t1 = Task.Factory.StartNew(() => { this.TestCaseDetailedViewModel.TestCase.SetNewExecutionOutcome(ExecutionContext.Preferences.TestPlan, testCaseExecutionType, comment); this.TestCaseDetailedViewModel.TestCase.LastExecutionOutcome = testCaseExecutionType; }); t1.ContinueWith(antecedent => { this.NavigateToTestCasesInitialView(); }, TaskScheduler.FromCurrentSynchronizationContext()); } }
/// <summary> /// Sets the new execution outcome. /// </summary> /// <param name="currentTestCase">The current test case.</param> /// <param name="testPlan">The test plan.</param> /// <param name="newExecutionOutcome">The new execution outcome.</param> /// <param name="comment">The comment.</param> /// <param name="testCaseRuns">The test case runs.</param> public static void SetNewExecutionOutcome(this TestCase currentTestCase, ITestPlan testPlan, TestCaseExecutionType newExecutionOutcome, string comment, Dictionary <int, TestCaseRun> testCaseRuns) { if (currentTestCase.ITestCase.Owner == null) { return; } var testPoints = testPlan.QueryTestPoints(string.Format("SELECT * FROM TestPoint WHERE TestCaseId = {0} ", currentTestCase.Id)); var testRun = testPlan.CreateTestRun(false); currentTestCase.IsRunning = string.Empty; DateTime startedDate = DateTime.Now; DateTime lastStartedDate = DateTime.Now; DateTime endDate = DateTime.Now; TimeSpan durationBeforePauses = new TimeSpan(); if (testCaseRuns.ContainsKey(currentTestCase.Id)) { lastStartedDate = testCaseRuns[currentTestCase.Id].LastStartedTime; startedDate = testCaseRuns[currentTestCase.Id].StartTime; durationBeforePauses = testCaseRuns[currentTestCase.Id].Duration; testCaseRuns.Remove(currentTestCase.Id); } testRun.DateStarted = startedDate; testRun.AddTestPoint(testPoints.Last(), ExecutionContext.TestManagementTeamProject.TestManagementService.AuthorizedIdentity); TimeSpan totalDuration = new TimeSpan((DateTime.Now - lastStartedDate).Ticks + durationBeforePauses.Ticks); testRun.DateCompleted = endDate; testRun.Save(); var result = testRun.QueryResults()[0]; result.Owner = ExecutionContext.TestManagementTeamProject.TestManagementService.AuthorizedIdentity; result.RunBy = ExecutionContext.TestManagementTeamProject.TestManagementService.AuthorizedIdentity; result.State = TestResultState.Completed; result.DateStarted = startedDate; result.Duration = totalDuration; result.DateCompleted = endDate; result.Comment = comment; switch (newExecutionOutcome) { case TestCaseExecutionType.Active: result.Outcome = TestOutcome.None; result.Duration = new TimeSpan(); break; case TestCaseExecutionType.Passed: result.Outcome = TestOutcome.Passed; break; case TestCaseExecutionType.Failed: result.Outcome = TestOutcome.Failed; break; case TestCaseExecutionType.Blocked: result.Outcome = TestOutcome.Blocked; break; } result.Save(); }
/// <summary> /// Sets the new execution outcome. /// </summary> /// <param name="currentTestCase">The current test case.</param> /// <param name="testPlan">The test plan.</param> /// <param name="newExecutionOutcome">The new execution outcome.</param> /// <param name="comment">The comment.</param> /// <param name="testCaseRuns">The test case runs.</param> public static void SetNewExecutionOutcome(this TestCase currentTestCase, ITestPlan testPlan, TestCaseExecutionType newExecutionOutcome, string comment, Dictionary<int, TestCaseRun> testCaseRuns) { if (currentTestCase.ITestCase.Owner == null) { return; } var testPoints = testPlan.QueryTestPoints(string.Format("SELECT * FROM TestPoint WHERE TestCaseId = {0} ", currentTestCase.Id)); var testRun = testPlan.CreateTestRun(false); currentTestCase.IsRunning = string.Empty; DateTime startedDate = DateTime.Now; DateTime lastStartedDate = DateTime.Now; DateTime endDate = DateTime.Now; TimeSpan durationBeforePauses = new TimeSpan(); if (testCaseRuns.ContainsKey(currentTestCase.Id)) { lastStartedDate = testCaseRuns[currentTestCase.Id].LastStartedTime; startedDate = testCaseRuns[currentTestCase.Id].StartTime; durationBeforePauses = testCaseRuns[currentTestCase.Id].Duration; testCaseRuns.Remove(currentTestCase.Id); } testRun.DateStarted = startedDate; testRun.AddTestPoint(testPoints.Last(), ExecutionContext.TestManagementTeamProject.TestManagementService.AuthorizedIdentity); TimeSpan totalDuration = new TimeSpan((DateTime.Now - lastStartedDate).Ticks + durationBeforePauses.Ticks); testRun.DateCompleted = endDate; testRun.Save(); var result = testRun.QueryResults()[0]; result.Owner = ExecutionContext.TestManagementTeamProject.TestManagementService.AuthorizedIdentity; result.RunBy = ExecutionContext.TestManagementTeamProject.TestManagementService.AuthorizedIdentity; result.State = TestResultState.Completed; result.DateStarted = startedDate; result.Duration = totalDuration; result.DateCompleted = endDate; result.Comment = comment; switch (newExecutionOutcome) { case TestCaseExecutionType.Active: result.Outcome = TestOutcome.None; result.Duration = new TimeSpan(); break; case TestCaseExecutionType.Passed: result.Outcome = TestOutcome.Passed; break; case TestCaseExecutionType.Failed: result.Outcome = TestOutcome.Failed; break; case TestCaseExecutionType.Blocked: result.Outcome = TestOutcome.Blocked; break; } result.Save(); }
/// <summary> /// Sets the new execution outcome internal. /// </summary> private void SetNewExecutionOutcomeInternal(TestCaseExecutionType testCaseExecutionType) { bool shouldCommentWindowShow = RegistryManager.Instance.ReadShouldCommentWindowShow(); string comment = String.Empty; bool isCanceled = false; if (shouldCommentWindowShow && testCaseExecutionType != TestCaseExecutionType.Active) { UIRegistryManager.Instance.WriteTitleTitlePromtDialog(string.Empty); var dialog = new PrompDialogRichTextBoxWindow(); dialog.ShowDialog(); Task t = Task.Factory.StartNew(() => { isCanceled = UIRegistryManager.Instance.GetIsCanceledPromtDialog(); comment = UIRegistryManager.Instance.GetContentPromtDialog(); while (string.IsNullOrEmpty(comment) && !isCanceled) { } }); t.Wait(); isCanceled = UIRegistryManager.Instance.GetIsCanceledPromtDialog(); comment = UIRegistryManager.Instance.GetContentPromtDialog(); } if (!isCanceled || !shouldCommentWindowShow) { Task t1 = Task.Factory.StartNew(() => { this.TestCaseDetailedViewModel.TestCase.SetNewExecutionOutcome(ExecutionContext.Preferences.TestPlan, testCaseExecutionType, comment, ExecutionContext.TestCaseRuns); this.TestCaseDetailedViewModel.TestCase.LastExecutionOutcome = testCaseExecutionType; }); t1.ContinueWith(antecedent => { Navigator.Instance.NavigateToTestCasesInitialView(this); }, TaskScheduler.FromCurrentSynchronizationContext()); } }
/// <summary> /// Sets the new execution outcome internal. /// </summary> /// <param name="testCaseExecutionType">Type of the test case execution.</param> private void SetNewExecutionOutcomeInternal(TestCaseExecutionType testCaseExecutionType) { bool shouldCommentWindowShow = RegistryManager.ReadShouldCommentWindowShow(); string comment = string.Empty; bool isCanceled = false; if (shouldCommentWindowShow && testCaseExecutionType != TestCaseExecutionType.Active) { RegistryManager.WriteTitleTitlePromtDialog(string.Empty); var dialog = new PrompDialogRichTextBoxWindow(); dialog.ShowDialog(); Task t = Task.Factory.StartNew(() => { isCanceled = RegistryManager.GetIsCanceledPromtDialog(); comment = RegistryManager.GetContentPromtDialog(); while (string.IsNullOrEmpty(comment) && !isCanceled) { } }); t.Wait(); isCanceled = RegistryManager.GetIsCanceledPromtDialog(); comment = RegistryManager.GetContentPromtDialog(); } if (!isCanceled || !shouldCommentWindowShow) { this.ShowTestCasesProgressbar(); List<TestCase> selectedTestCases = this.GetSelectedTestCasesInternal(); Task t1 = Task.Factory.StartNew(() => { foreach (var currentTestCase in selectedTestCases) { currentTestCase.SetNewExecutionOutcome(ExecutionContext.Preferences.TestPlan, testCaseExecutionType, comment); currentTestCase.LastExecutionOutcome = testCaseExecutionType; } }); t1.ContinueWith(antecedent => { this.HideTestCasesProgressbar(); this.TestCasesInitialViewModel.FilterTestCases(); }, TaskScheduler.FromCurrentSynchronizationContext()); } }