public IFunctionsTest GenerateTestTask() { ITestScenario scenario = null; switch (this.Platform) { case Platorm.AzureOnly: switch (this.Trigger) { case TriggerType.Blob: scenario = new AzureBlobTestScenario(); break; case TriggerType.Queue: throw new NotImplementedException(); case TriggerType.Http: throw new NotImplementedException(); default: throw new ArgumentException("Unknown trigger type " + this.Trigger); } break; case Platorm.AmazonOnly: throw new NotImplementedException(); case Platorm.AzureAnyAmazon: throw new NotImplementedException(); } scenario.PrepareData(InputObjectsCount); return(scenario.GetBenchmarkTest(FunctionName)); }
public XElement CreateTestResultsXElementCommon( ITestSuite suite, ITestScenario scenario, IOrderedEnumerable <ITestResult> testResults, IXMLElementsStruct xmlStruct) { var testResultsFiltered = from testResult in testResults where testResult.SuiteId == suite.Id && testResult.ScenarioId == scenario.Id && testResult.Id != null && testResult.Name != null && testResult.PlatformUniqueId == scenario.PlatformUniqueId select testResult; if (!testResultsFiltered.Any()) { return(null); } var testResultsElement = new XElement(xmlStruct.TestResultsNode, from testResult in testResultsFiltered select GetTestResultsXElement(testResult, xmlStruct) ); return(testResultsElement); }
public void Start() { ValidateMonoDevelopBinPath(); var logFile = SetupIdeLogFolder(); string profilePath = Util.CreateTmpDir(); FoldersToClean.Add(profilePath); scenario = provider.GetTestScenario(); if (!StartWithProfiler(profilePath, logFile)) { TestService.StartSession(MonoDevelopBinPath, profilePath, logFile); } TestService.Session.DebugObject = new UITestDebug(); TestService.Session.WaitForElement(IdeQuery.DefaultWorkbench); leakProcessor = new LeakProcessor(scenario, ProfilerOptions); ReportMemoryUsage(setupIteration); for (int i = 0; i < Iterations; ++i) { scenario.Run(); ReportMemoryUsage(i); } UserInterfaceTests.Ide.CloseAll(exit: false); ReportMemoryUsage(cleanupIteration); }
private async Task <List <TestResult> > TestScenario(ITestScenario testScenario) { _logger.LogInformation($"=========================== {testScenario.Name} ==========================="); var results = new List <TestResult>(); int order = 1; foreach (var step in testScenario.Steps) { try { _logger.LogInformation($"Executing test step: " + $"'{step.Name}' ({order}/{testScenario.Steps.Count()})."); var testResult = await step.ExecuteAsync(); await Task.Delay(1000); Debug.Assert(order == testResult.Order); _logger.LogInformation($"Test step: '{step.Name}' ({testResult.Order}/{testScenario.Steps.Count()}) has " + $"{(testResult.Passed ? "passed" : "failed")}."); results.Add(testResult); } catch (Exception e) { _logger.LogError($"Failed {e}"); throw; } order++; } return(results); }
XElement GetScenariosXElement( ITestSuite suite, ITestScenario scenario, IOrderedEnumerable <ITestResult> testResults, IXMLElementsStruct xmlStruct) { var scenariosElement = new XElement(xmlStruct.ScenarioNode, new XAttribute("uniqueId", scenario.UniqueId), new XAttribute("id", scenario.Id), new XAttribute("name", scenario.Name), new XAttribute("status", scenario.Status), CreateXattribute(xmlStruct.TimeSpentAttribute, Convert.ToInt32(suite.Statistics.TimeSpent)), new XAttribute("all", scenario.Statistics.All.ToString()), new XAttribute("passed", scenario.Statistics.Passed.ToString()), CreateXattribute(xmlStruct.FailedAttribute, scenario.Statistics.Failed.ToString()), new XAttribute("notTested", scenario.Statistics.NotTested.ToString()), new XAttribute("knownIssue", scenario.Statistics.PassedButWithBadSmell.ToString()), CreateXattribute("description", scenario.Description), CreateXattribute("platformId", scenario.PlatformId), CreateXattribute("platformUniqueId", scenario.PlatformUniqueId), CreateTestResultsXElementCommon( suite, scenario, testResults, xmlStruct) ); return(scenariosElement); }
// 20140720 // string getStatisticsStringScenario(TestScenario scenario, bool skipAutomatic) string getStatisticsStringScenario(ITestScenario scenario, bool skipAutomatic) { string result = string.Empty; // 20130322 //TestData.RefreshScenarioStatistics(scenario); // 20141107 // TestData.RefreshScenarioStatistics(scenario, skipAutomatic); var testStatistics = new TestStatistics(); testStatistics.RefreshScenarioStatistics(scenario, skipAutomatic); result += @"<div id=""scenariostat"">"; // test results result += @"Test cases:"; result += scenario.Statistics.All.ToString(); result += " Passed:"; result += scenario.Statistics.Passed.ToString(); result += " Failed:"; result += scenario.Statistics.Failed.ToString(); result += " Not tested:"; result += scenario.Statistics.NotTested.ToString(); result += " Time spent:"; result += Convert.ToInt32(scenario.Statistics.TimeSpent).ToString(); result += @" seconds</div>"; return(result); }
public static async Task <T> Step <T>(this ITestScenario scenarioStepExecutor, string description, Func <Task <T> > action, [CallerFilePath] string filePath = "", [CallerMemberName] string methodName = "", [CallerLineNumber] int lineNumber = 0) { T result = default(T); await scenarioStepExecutor.Step(description, async() => { result = await action(); }, filePath, methodName, lineNumber); return(result); }
public virtual TestStat RefreshScenarioStatistics(ITestScenario scenario, bool skipAutomatic) { var testScenarioStatistics = new TestStat(); if (null != scenario.TestResults && 0 < scenario.TestResults.Count) { testScenarioStatistics.All = scenario.TestResults.Count; foreach (var testResult in scenario.TestResults) { // if (skipAutomatic) // if (TestResultOrigins.Automatic == testResult.Origin) // continue; if (skipAutomatic && TestResultOrigins.Automatic == testResult.Origin) { continue; } // if (testResult.enStatus == TestResultStatuses.Passed || testResult.enStatus == TestResultStatuses.KnownIssue) { // testScenarioStatistics.Passed++; // if (testResult.enStatus == TestResultStatuses.KnownIssue) // testScenarioStatistics.PassedButWithBadSmell++; // } // switch (testResult.enStatus) { // case TestResultStatuses.Passed: // case TestResultStatuses.KnownIssue: // testScenarioStatistics.Passed++; // if (testResult.enStatus == TestResultStatuses.KnownIssue) // testScenarioStatistics.PassedButWithBadSmell++; // break; // } // if (testResult.enStatus == TestResultStatuses.Failed) // testScenarioStatistics.Failed++; switch (testResult.enStatus) { case TestStatuses.Passed: testScenarioStatistics.Passed++; break; case TestStatuses.Failed: testScenarioStatistics.Failed++; break; case TestStatuses.KnownIssue: testScenarioStatistics.PassedButWithBadSmell++; break; // case TestResultStatuses.NotTested: // testScenarioStatistics.NotTested++; // break; } testScenarioStatistics.TimeSpent += testResult.TimeSpent; } } testScenarioStatistics.NotTested = testScenarioStatistics.All - testScenarioStatistics.Passed - testScenarioStatistics.Failed - testScenarioStatistics.PassedButWithBadSmell; scenario.Statistics = testScenarioStatistics; setTestScenarioStatus(scenario); return(testScenarioStatistics); }
public ProfilerProcessor(ITestScenario scenario, ProfilerOptions options) { Options = options; visitor = new Visitor(this, scenario.GetTrackedTypes()); processingThread = new Thread(new ThreadStart(ProcessFile)); processingThread.Start(); }
public void RunTestScenario( TestScenarioExecCmdletBase cmdlet, ITestSuite testSuite, ITestScenario testScenario) { // run BeforeScenario scriptblocks //if (null != testSuite) { // 20140208 // if (null == testSuite || null == testScenario || 0 >= testScenario.TestCases.Count) return; if (null == testSuite || null == testScenario || 0 == testScenario.TestCases.Count) return; // if (null != testSuite && null != testScenario && 0 < testScenario.TestCases.Count) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testSuite.BeforeScenario, testSuite.BeforeScenario.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testSuite.BeforeScenarioParameters); //} foreach (ITestCase testCase in testScenario.TestCases) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testScenario.BeforeTest, testScenario.BeforeTest.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testScenario.BeforeTestParameters); cmdlet.runTwoScriptBlockCollections( // 20141211 // testCase.TestCode, testCase.TestCode.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, cmdlet, testCase.TestCodeParameters); cmdlet.runTwoScriptBlockCollections( // 20141211 // testScenario.AfterTest, testScenario.AfterTest.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testScenario.AfterTestParameters); } // run AfterScenario scriptblocks //if (null != testSuite) { //if (null != testSuite && null != testScenario && 0 < testScenario.TestCases.Count) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testSuite.AfterScenario, testSuite.AfterScenario.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testSuite.AfterScenarioParameters); }
void test_loop(ref ITestScenario test) { if (test.Update(RND)) { return; } test.Cleanup(); test = null; }
public virtual TestStat RefreshScenarioStatistics(ITestScenario scenario, bool skipAutomatic) { var testScenarioStatistics = new TestStat(); if (null != scenario.TestResults && 0 < scenario.TestResults.Count) { testScenarioStatistics.All = scenario.TestResults.Count; foreach (var testResult in scenario.TestResults) { // if (skipAutomatic) // if (TestResultOrigins.Automatic == testResult.Origin) // continue; if (skipAutomatic && TestResultOrigins.Automatic == testResult.Origin) continue; // if (testResult.enStatus == TestResultStatuses.Passed || testResult.enStatus == TestResultStatuses.KnownIssue) { // testScenarioStatistics.Passed++; // if (testResult.enStatus == TestResultStatuses.KnownIssue) // testScenarioStatistics.PassedButWithBadSmell++; // } // switch (testResult.enStatus) { // case TestResultStatuses.Passed: // case TestResultStatuses.KnownIssue: // testScenarioStatistics.Passed++; // if (testResult.enStatus == TestResultStatuses.KnownIssue) // testScenarioStatistics.PassedButWithBadSmell++; // break; // } // if (testResult.enStatus == TestResultStatuses.Failed) // testScenarioStatistics.Failed++; // 20150219 switch (testResult.enStatus) { case TestResultStatuses.Passed: testScenarioStatistics.Passed++; break; case TestResultStatuses.Failed: testScenarioStatistics.Failed++; break; case TestResultStatuses.KnownIssue: testScenarioStatistics.PassedButWithBadSmell++; break; // case TestResultStatuses.NotTested: // testScenarioStatistics.NotTested++; // break; } testScenarioStatistics.TimeSpent += testResult.TimeSpent; } } // 20150219 // testScenarioStatistics.NotTested = testScenarioStatistics.All - testScenarioStatistics.Passed - testScenarioStatistics.Failed; testScenarioStatistics.NotTested = testScenarioStatistics.All - testScenarioStatistics.Passed - testScenarioStatistics.Failed -testScenarioStatistics.PassedButWithBadSmell; scenario.Statistics = testScenarioStatistics; setTestScenarioStatus(scenario); return testScenarioStatistics; }
internal ResultKey(ITestScenario scenario, String fileName, String methodName) : this(scenario.AssemblyName, scenario.TargetRuntime, scenario.TargetArchitecture, scenario.ExecutionRuntime, scenario.ExecutionArchitecture, fileName, methodName) { }
protected virtual void stop_test() { if (current_test == null) { return; } current_test.Cleanup(); current_test = null; RND = null; }
protected virtual void setup_test(ITestScenario test) { var msg = test.Setup(); if (string.IsNullOrEmpty(msg)) { current_test = test; RND = new System.Random(DateTime.Now.Second); } else { Utils.Message(msg); } }
private static async Task PerformReusableScenarioPart(ITestScenario scenario) { await scenario.Step("This is the second step", async() => { await scenario.Step("This is the first sub-step of second step", () => { // Here comes the logic }); await scenario.Step("This is the second sub-step of second step", () => { // Here comes the logic }); }); }
public static Dictionary <string, NoLeakAttribute> GetLeakAttributes(this ITestScenario scenario, bool isCleanup) { var scenarioType = scenario.GetType(); // If it's targeting the class, check on cleanup iteration, otherwise, check the run method. var member = isCleanup ? scenarioType : (MemberInfo)scenarioType.GetMethod("Run"); var attributes = member.GetCustomAttributes <NoLeakAttribute> (true).ToDictionary(x => x.TypeName, x => x); // TODO: Ensure that we don't leak, so add GtkWidgetResult results, as they can cause retention of UI widgets. attributes.Add(autoTest, new NoLeakAttribute(autoTest)); return(attributes); }
public static Dictionary <string, NoLeakAttribute> GetLeakAttributes(this ITestScenario scenario, bool isCleanup) { var scenarioType = scenario.GetType(); // If it's targeting the class, check on cleanup iteration, otherwise, check the run method. var member = isCleanup ? scenarioType : (MemberInfo)scenarioType.GetMethod(nameof(ITestScenario.Run)); var attributes = member.GetCustomAttributes <NoLeakAttribute> (true).ToDictionary(x => x.TypeName, x => x); // Ensure that we don't leak, so add AutoTest results, as they can cause retention of UI widgets. foreach (var type in resultTypes) { attributes.Add(type.FullName, new NoLeakAttribute(type)); } return(attributes); }
public void Start() { ValidateMonoDevelopBinPath(); SetupIdeLogFolder(); string profilePath = Util.CreateTmpDir(); FoldersToClean.Add(profilePath); if (ProfilerOptions.Type != StressTestOptions.ProfilerOptions.ProfilerType.Disabled) { if (ProfilerOptions.MlpdOutputPath == null) { ProfilerOptions.MlpdOutputPath = Path.Combine(profilePath, "profiler.mlpd"); } if (File.Exists(ProfilerOptions.MlpdOutputPath)) { File.Delete(ProfilerOptions.MlpdOutputPath); } profilerProcessor = new ProfilerProcessor(ProfilerOptions); string monoPath = Environment.GetEnvironmentVariable("PATH") .Split(Path.PathSeparator) .Select(p => Path.Combine(p, "mono")) .FirstOrDefault(s => File.Exists(s)); TestService.StartSession(monoPath, profilePath, $"{profilerProcessor.GetMonoArguments ()} \"{MonoDevelopBinPath}\""); Console.WriteLine($"Profler is logging into {ProfilerOptions.MlpdOutputPath}"); } else { TestService.StartSession(MonoDevelopBinPath, profilePath); } TestService.Session.DebugObject = new UITestDebug(); TestService.Session.WaitForElement(IdeQuery.DefaultWorkbench); scenario = TestScenarioProvider.GetTestScenario(); ReportMemoryUsage(-1); for (int i = 0; i < Iterations; ++i) { scenario.Run(); ReportMemoryUsage(i); } UserInterfaceTests.Ide.CloseAll(exit: false); ReportMemoryUsage(cleanupIteration); }
public static HashSet <string> GetTrackedTypes(this ITestScenario scenario) { var result = new HashSet <string> (); var scenarioType = scenario.GetType(); foreach (var attr in scenarioType.GetCustomAttributes <NoLeakAttribute> (true)) { result.Add(attr.TypeName); } foreach (var attr in scenarioType.GetMethod("Run").GetCustomAttributes <NoLeakAttribute> (true)) { result.Add(attr.TypeName); } result.Add(autoTest); return(result); }
public void Start() { ValidateMonoDevelopBinPath(); SetupIdeLogFolder(); string profilePath = Util.CreateTmpDir(); FoldersToClean.Add(profilePath); TestService.StartSession(MonoDevelopBinPath, profilePath); TestService.Session.DebugObject = new UITestDebug(); TestService.Session.WaitForElement(IdeQuery.DefaultWorkbench); scenario = TestScenarioProvider.GetTestScenario(); for (int i = 0; i < Iterations; ++i) { scenario.Run(); ReportMemoryUsage(i); } }
public void Start() { ValidateMonoDevelopBinPath(); var logFile = SetupIdeLogFolder(); string profilePath = Util.CreateTmpDir(); FoldersToClean.Add(profilePath); scenario = provider.GetTestScenario(); if (!StartWithProfiler(profilePath, logFile)) { TestService.StartSession(MonoDevelopBinPath, profilePath, logFile); } TestService.Session.DebugObject = new UITestDebug(); TestService.Session.WaitForElement(IdeQuery.DefaultWorkbench, 10000); leakProcessor = new LeakProcessor(scenario, ProfilerOptions); ReportMemoryUsage("Setup"); RunTestScenario(); UserInterfaceTests.Ide.CloseAll(exit: false); ReportMemoryUsage("Cleanup"); if (profilerProcessor != null) { var task = profilerProcessor.RemainingHeapshotsTask; if (!task.IsCompleted) { Console.WriteLine("Still processing heapshots..."); } task.Wait(); } }
public UserSession(IWebRequestSignatureService sessionManager, ObjectFactory objectFactory, string name, ITestScenario scenario) { if (sessionManager == null) { throw new ArgumentNullException(nameof(sessionManager)); } if (objectFactory == null) { throw new ArgumentNullException(nameof(objectFactory)); } if (scenario == null) { throw new ArgumentNullException(nameof(scenario)); } if (string.IsNullOrWhiteSpace(name)) { throw new NotSupportedException("A name must be supplied."); } _sessionManager = sessionManager; ObjectFactory = objectFactory; Scenario = scenario; Name = name; }
void setTestScenarioStatus(ITestScenario scenario) { scenario.enStatus = scenario.Statistics.PassedButWithBadSmell > 0 ? TestScenarioStatuses.KnownIssue : scenario.Statistics.Failed > 0 ? TestScenarioStatuses.Failed : scenario.Statistics.Passed > 0 ? TestScenarioStatuses.Passed : TestScenarioStatuses.NotTested; }
public static string Write(this ITestScenario scenario) { return($"// [SCENARIO #{scenario.ID:0000}] {scenario.Name}"); }
public void RunTestScenario( TestScenarioExecCmdletBase cmdlet, ITestSuite testSuite, ITestScenario testScenario) { // run BeforeScenario scriptblocks //if (null != testSuite) { if (null != testSuite && null != testScenario && 0 < testScenario.TestCases.Count) { cmdlet.runTwoScriptBlockCollections( testSuite.BeforeScenario, null, // alternate scriptblocks cmdlet, testSuite.BeforeScenarioParameters); //} foreach (ITestCase testCase in testScenario.TestCases) { cmdlet.runTwoScriptBlockCollections( testScenario.BeforeTest, null, // alternate scriptblocks cmdlet, testScenario.BeforeTestParameters); cmdlet.runTwoScriptBlockCollections( testCase.TestCode, null, cmdlet, testCase.TestCodeParameters); cmdlet.runTwoScriptBlockCollections( testScenario.AfterTest, null, // alternate scriptblocks cmdlet, testScenario.AfterTestParameters); } // run AfterScenario scriptblocks //if (null != testSuite) { //if (null != testSuite && null != testScenario && 0 < testScenario.TestCases.Count) { cmdlet.runTwoScriptBlockCollections( testSuite.AfterScenario, null, // alternate scriptblocks cmdlet, testSuite.AfterScenarioParameters); } }
// 20140720 // string getStatisticsStringScenario(TestScenario scenario, bool skipAutomatic) string getStatisticsStringScenario(ITestScenario scenario, bool skipAutomatic) { string result = string.Empty; // 20130322 //TestData.RefreshScenarioStatistics(scenario); // 20141107 // TestData.RefreshScenarioStatistics(scenario, skipAutomatic); var testStatistics = new TestStatistics(); testStatistics.RefreshScenarioStatistics(scenario, skipAutomatic); result += @"<div id=""scenariostat"">"; // test results result += @"Test cases:"; result += scenario.Statistics.All.ToString(); result += " Passed:"; result += scenario.Statistics.Passed.ToString(); result += " Failed:"; result += scenario.Statistics.Failed.ToString(); result += " Not tested:"; result += scenario.Statistics.NotTested.ToString(); result += " Time spent:"; result += Convert.ToInt32(scenario.Statistics.TimeSpent).ToString(); result += @" seconds</div>"; return result; }
internal void setScenarioStatus(ITestScenario testScenario, bool skipAutomatic) { int counterPassedResults = 0; int counterKnownIssueResults = 0; if (null != testScenario.TestResults && 0 < testScenario.TestResults.Count) { foreach (var testResult in testScenario.TestResults) { switch (testResult.enStatus) { case TestResultStatuses.Passed: counterPassedResults++; if (TestScenarioStatuses.Failed != testScenario.enStatus) testScenario.enStatus = TestScenarioStatuses.Passed; break; case TestResultStatuses.Failed: testScenario.enStatus = TestScenarioStatuses.Failed; return; case TestResultStatuses.NotTested: break; case TestResultStatuses.KnownIssue: counterKnownIssueResults++; if (TestScenarioStatuses.Failed != testScenario.enStatus) testScenario.enStatus = TestScenarioStatuses.Passed; break; default: throw new Exception("Invalid value for TestResultStatuses"); } } if (0 == counterPassedResults && 0 < counterKnownIssueResults) testScenario.enStatus = TestScenarioStatuses.KnownIssue; var testStatistics = new TestStatistics(); testStatistics.RefreshScenarioStatistics(testScenario, skipAutomatic); } }
public LeakProcessor(ITestScenario scenario, ProfilerOptions options) { ProfilerOptions = options; this.scenario = scenario; }
public XElement CreateTestResultsXElementCommon( ITestSuite suite, ITestScenario scenario, IOrderedEnumerable<ITestResult> testResults, IXMLElementsStruct xmlStruct) { var testResultsFiltered = from testResult in testResults where testResult.SuiteId == suite.Id && testResult.ScenarioId == scenario.Id && testResult.Id != null && testResult.Name != null && testResult.PlatformUniqueId == scenario.PlatformUniqueId select testResult; if (!testResultsFiltered.Any()) { return null; } var testResultsElement = new XElement(xmlStruct.TestResultsNode, from testResult in testResultsFiltered select getTestResultsXElement(testResult, xmlStruct) ); return testResultsElement; }
void setTestScenarioStatus(ITestScenario scenario) { scenario.enStatus = scenario.Statistics.PassedButWithBadSmell > 0 ? TestStatuses.KnownIssue : scenario.Statistics.Failed > 0 ? TestStatuses.Failed : scenario.Statistics.Passed > 0 ? TestStatuses.Passed : TestStatuses.NotRun; }
internal void SetScenarioStatus(ITestScenario testScenario, bool skipAutomatic) { var counterPassedResults = 0; var counterKnownIssueResults = 0; if (null != testScenario.TestResults && 0 < testScenario.TestResults.Count) { foreach (var testResult in testScenario.TestResults) { switch (testResult.enStatus) { // 20150805 // case TestResultStatuses.Passed: case TestStatuses.Passed: counterPassedResults++; // 20150805 // if (TestScenarioStatuses.Failed != testScenario.enStatus) if (TestStatuses.Failed != testScenario.enStatus) { // 20150805 // testScenario.enStatus = TestScenarioStatuses.Passed; testScenario.enStatus = TestStatuses.Passed; } break; // 20150805 // case TestResultStatuses.Failed: case TestStatuses.Failed: // 20150805 // testScenario.enStatus = TestScenarioStatuses.Failed; testScenario.enStatus = TestStatuses.Failed; return; // 20150805 // case TestResultStatuses.NotTested: case TestStatuses.NotRun: break; // 20150805 // case TestResultStatuses.KnownIssue: case TestStatuses.KnownIssue: counterKnownIssueResults++; // 20150805 // if (TestScenarioStatuses.Failed != testScenario.enStatus) if (TestStatuses.Failed != testScenario.enStatus) { // 20150805 // testScenario.enStatus = TestScenarioStatuses.Passed; testScenario.enStatus = TestStatuses.Passed; } break; default: throw new Exception("Invalid value for TestResultStatuses"); } } if (0 == counterPassedResults && 0 < counterKnownIssueResults) { // 20150805 // testScenario.enStatus = TestScenarioStatuses.KnownIssue; testScenario.enStatus = TestStatuses.KnownIssue; } // 20150925 // var testStatistics = new TestStatistics(); var testStatistics = ProxyFactory.Get <TestStatistics>(); testStatistics.RefreshScenarioStatistics(testScenario, skipAutomatic); } }
public LoginSteps(DependencySetupFixture fixture) { TestScenario = fixture.ServiceProvider.GetService <ITestScenario <CookiesPage> >(); }
internal void SetScenarioStatus(ITestScenario testScenario, bool skipAutomatic) { var counterPassedResults = 0; var counterKnownIssueResults = 0; if (null != testScenario.TestResults && 0 < testScenario.TestResults.Count) { foreach (var testResult in testScenario.TestResults) { switch (testResult.enStatus) { // 20150805 // case TestResultStatuses.Passed: case TestStatuses.Passed: counterPassedResults++; // 20150805 // if (TestScenarioStatuses.Failed != testScenario.enStatus) if (TestStatuses.Failed != testScenario.enStatus) // 20150805 // testScenario.enStatus = TestScenarioStatuses.Passed; testScenario.enStatus = TestStatuses.Passed; break; // 20150805 // case TestResultStatuses.Failed: case TestStatuses.Failed: // 20150805 // testScenario.enStatus = TestScenarioStatuses.Failed; testScenario.enStatus = TestStatuses.Failed; return; // 20150805 // case TestResultStatuses.NotTested: case TestStatuses.NotRun: break; // 20150805 // case TestResultStatuses.KnownIssue: case TestStatuses.KnownIssue: counterKnownIssueResults++; // 20150805 // if (TestScenarioStatuses.Failed != testScenario.enStatus) if (TestStatuses.Failed != testScenario.enStatus) // 20150805 // testScenario.enStatus = TestScenarioStatuses.Passed; testScenario.enStatus = TestStatuses.Passed; break; default: throw new Exception("Invalid value for TestResultStatuses"); } } if (0 == counterPassedResults && 0 < counterKnownIssueResults) // 20150805 // testScenario.enStatus = TestScenarioStatuses.KnownIssue; testScenario.enStatus = TestStatuses.KnownIssue; // 20150925 // var testStatistics = new TestStatistics(); var testStatistics = ProxyFactory.Get<TestStatistics>(); testStatistics.RefreshScenarioStatistics(testScenario, skipAutomatic); } }
public static string Write(this ITestScenario scenario) { return(WriteIndentedText($"// [SCENARIO #{scenario.ID:0000}] {scenario.Name}", 2)); }
public void Initialize(ITestScenario scenario) => Scenario = scenario;
// 20140720 public void RunTestCase( TestCaseExecCmdletBase cmdlet, // 20140720 // TestSuite testSuite, // TestScenario testScenario) ITestSuite testSuite, ITestScenario testScenario) { var testCase = TestData.GetTestCase( testSuite, string.Empty, //cmdlet.Name cmdlet.Id, testScenario.Name, testScenario.Id, testSuite.Name, testSuite.Id, // 20141119 // testScenario.PlatformId); testScenario.PlatformUniqueId); if (null == testCase) { return; } // run BeforeScenario scriptblocks //if (null != testSuite) { if (null != testSuite && null != testScenario) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testSuite.BeforeScenario, testSuite.BeforeScenario.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testSuite.BeforeScenarioParameters); } // run BeforeTest scriptblocks if (null != testScenario) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testScenario.BeforeTest, testScenario.BeforeTest.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testScenario.BeforeTestParameters); } // run TestCode scriptblocks cmdlet.runTwoScriptBlockCollections( //cmdlet.TestCode, // 20141211 // testCase.TestCode, testCase.TestCode.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, cmdlet, cmdlet.TestCodeParameters); // run AfterTest scriptblocks if (null != testScenario) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testScenario.AfterTest, testScenario.AfterTest.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testScenario.AfterTestParameters); } // run AfterScenario scriptblocks //if (null != testSuite) { if (null != testSuite && null != testScenario) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testSuite.AfterScenario, testSuite.AfterScenario.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testSuite.AfterScenarioParameters); } }
XElement getScenariosXElement( ITestSuite suite, ITestScenario scenario, IOrderedEnumerable<ITestResult> testResults, IXMLElementsStruct xmlStruct) { var scenariosElement = new XElement(xmlStruct.ScenarioNode, new XAttribute("uniqueId", scenario.UniqueId), new XAttribute("id", scenario.Id), new XAttribute("name", scenario.Name), new XAttribute("status", scenario.Status), createXattribute(xmlStruct.TimeSpentAttribute, Convert.ToInt32(suite.Statistics.TimeSpent)), new XAttribute("all", scenario.Statistics.All.ToString()), new XAttribute("passed", scenario.Statistics.Passed.ToString()), createXattribute(xmlStruct.FailedAttribute, scenario.Statistics.Failed.ToString()), new XAttribute("notTested", scenario.Statistics.NotTested.ToString()), new XAttribute("knownIssue", scenario.Statistics.PassedButWithBadSmell.ToString()), createXattribute("description", scenario.Description), createXattribute("platformId", scenario.PlatformId), createXattribute("platformUniqueId", scenario.PlatformUniqueId), CreateTestResultsXElementCommon( suite, scenario, testResults, xmlStruct) ); return scenariosElement; }
public void RunTestScenario( TestScenarioExecCmdletBase cmdlet, ITestSuite testSuite, ITestScenario testScenario) { // run BeforeScenario scriptblocks //if (null != testSuite) { // 20140208 // if (null == testSuite || null == testScenario || 0 >= testScenario.TestCases.Count) return; if (null == testSuite || null == testScenario || 0 == testScenario.TestCases.Count) { return; } // if (null != testSuite && null != testScenario && 0 < testScenario.TestCases.Count) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testSuite.BeforeScenario, testSuite.BeforeScenario.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testSuite.BeforeScenarioParameters); //} foreach (ITestCase testCase in testScenario.TestCases) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testScenario.BeforeTest, testScenario.BeforeTest.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testScenario.BeforeTestParameters); cmdlet.runTwoScriptBlockCollections( // 20141211 // testCase.TestCode, testCase.TestCode.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, cmdlet, testCase.TestCodeParameters); cmdlet.runTwoScriptBlockCollections( // 20141211 // testScenario.AfterTest, testScenario.AfterTest.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testScenario.AfterTestParameters); } // run AfterScenario scriptblocks //if (null != testSuite) { //if (null != testSuite && null != testScenario && 0 < testScenario.TestCases.Count) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testSuite.AfterScenario, testSuite.AfterScenario.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testSuite.AfterScenarioParameters); }
// 20140720 public void RunTestCase( TestCaseExecCmdletBase cmdlet, // 20140720 // TestSuite testSuite, // TestScenario testScenario) ITestSuite testSuite, ITestScenario testScenario) { var testCase = TestData.GetTestCase( testSuite, string.Empty, //cmdlet.Name cmdlet.Id, testScenario.Name, testScenario.Id, testSuite.Name, testSuite.Id, // 20141119 // testScenario.PlatformId); testScenario.PlatformUniqueId); if (null == testCase) { return; } // run BeforeScenario scriptblocks //if (null != testSuite) { if (null != testSuite && null != testScenario) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testSuite.BeforeScenario, testSuite.BeforeScenario.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testSuite.BeforeScenarioParameters); } // run BeforeTest scriptblocks if (null != testScenario) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testScenario.BeforeTest, testScenario.BeforeTest.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testScenario.BeforeTestParameters); } // run TestCode scriptblocks cmdlet.runTwoScriptBlockCollections( //cmdlet.TestCode, // 20141211 // testCase.TestCode, testCase.TestCode.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, cmdlet, cmdlet.TestCodeParameters); // run AfterTest scriptblocks if (null != testScenario) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testScenario.AfterTest, testScenario.AfterTest.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testScenario.AfterTestParameters); } // run AfterScenario scriptblocks //if (null != testSuite) { if (null != testSuite && null != testScenario) { cmdlet.runTwoScriptBlockCollections( // 20141211 // testSuite.AfterScenario, testSuite.AfterScenario.Select(codeblock => ScriptBlock.Create(codeblock.Code)).ToArray(), null, // alternate scriptblocks cmdlet, testSuite.AfterScenarioParameters); } }