/// <summary> /// Method called by the TestCaseRunner when a test finishes /// </summary> /// <param name="testcaseScript"></param> private void OnTaskTestRunFinishedEvent(TestScript testcaseScript) { if (testcaseScript.TestExecutionStatus == TestExecutionStatus.Failed && ShouldRetry(testcaseScript.LastExecutionErrorMsg)) { if (testcaseScript.RetryCount < 1) { RemoveItemThreadSafe(testcaseScript); testcaseScript.TestExecutionStatus = TestExecutionStatus.WillRetry; testcaseScript.RetryCount++; AddItemThreadSafe(testcaseScript); } } OnMethodStatusChanged(testcaseScript); }
public void LoadAssembly() { var assembly = Assembly.LoadFrom(_testFrameworkRunner.GetAssemblyPath()); TestClassesList.Clear(); CustomAttributesList.Clear(); foreach (var classes in assembly.GetTypes()) { if (!classes.IsClass && !classes.IsPublic) { continue; } var methodInfos = GetTestMethodsList(classes); if (!methodInfos.Any()) { continue; } var className = classes.Name; foreach (var testMethod in methodInfos) { var testScript = new TestScript(_pluginLoader) { ClassName = className, Name = testMethod.Name, TestExecutionStatus = TestExecutionStatus.Active, LastExecutionErrorMsg = string.Empty, TestDescription = GetDescriptionAttributeValue(testMethod), CustomAtributteList = GetCustomAttributes(testMethod) }; TestClassesList.Add(testScript); } } }
/// <summary> /// Update the count properties based on the status of a testmethod /// </summary> /// <param name="testcasemethod"></param> public void Update(TestScript testcasemethod) { switch (testcasemethod.TestExecutionStatus) { case TestExecutionStatus.Failed: { Interlocked.Decrement(ref TotRunning); Interlocked.Increment(ref TotFailed); break; } case TestExecutionStatus.Passed: { Interlocked.Decrement(ref TotRunning); Interlocked.Increment(ref TotPassed); break; } case TestExecutionStatus.Running: { Interlocked.Increment(ref TotRunning); Interlocked.Decrement(ref TotWaiting); break; } case TestExecutionStatus.Waiting: { Interlocked.Increment(ref TotWaiting); break; } case TestExecutionStatus.WillRetry: { Interlocked.Decrement(ref TotRunning); Interlocked.Increment(ref TotWaiting); break; } } }