public TestManager() { _report = new ReportingTools("QA Simulator"); ExcelWriter excelWriter = new ExcelWriter(_report.getFileLocation()); DateTime start = _report.getNow(); originStart = start; List <Action> tests = new List <Action>(); tests.Add(Test_CreateNewClient); tests.Add(Test_AddNewVisitPlan); tests.Add(Test_SetProvider); tests.Add(Test_CompleteScheduledVisit); foreach (Action test in tests) { _report.createReportItem(""); start = _report.getNow(); _report.createReportItem(test.Method.Name); try { createSUT(); test(); _report.createReportItem($"{test.Method.Name}", start); } catch (Exception e) { ScreenCapturer.CaptureAndSave($@"S:\Dev_IMS\Development\Jordan\uiAutomation\systemMapping\%NOW%_{test.Method.Name}", CaptureMode.Screen); _report.createReportItem($"Test failure {test.Method.Name}", start, $"Target: {e.TargetSite} Source: {e.Source} Message: {e.Message}"); excelWriter.WriteToFile(_report.getReport()); ShutDownSystemUnderTest close = new ShutDownSystemUnderTest(_application); return; } } _report.createReportItem(""); _report.createReportItem("Test Set Complete", originStart); excelWriter.WriteToFile(_report.getReport()); }
private void Test_CreateNewClient() { string facilityName = "CBI Toronto Yonge"; start = _report.getNow(); new TestStackTest.Views.Login(_application, new TestStackTest.Commands.LoginDefault()); _report.createReportItem("System Login - Create New Client", start); start = _report.getNow(); new TestStackTest.Views.SelectFacility(_application, new TestStackTest.Commands.SelectFacilityDefault(), facilityName); _report.createReportItem("Select Facility - Create New Client", start); start = _report.getNow(); new TestStackTest.Views.Desktop(_application, new TestStackTest.Commands.Desktop_ClickButton(), 0); _report.createReportItem("Click Desktop Client Button- Create New Client", start); start = _report.getNow(); new TestStackTest.Views.ClientCaseSearch(_application, new TestStackTest.Commands.ClientCaseSearch_SearchLastName(), "ZZZZZZZZZZZZZZZZZZZZZZZZZZZ"); _report.createReportItem("Search For Unkown Client - Create New Client", start); // the step above should result in a message box appearing saying that no user of that name has been found, but if it doesn't open skip closing it if (_application.GetWindows().Count == 3) { start = _report.getNow(); new TestStackTest.Views.MessageBox(_application, new TestStackTest.Commands.MessageBoxDefault()); _report.createReportItem("Close Unknown Client Modal Message Box - Create New Client", start); } start = _report.getNow(); new TestStackTest.Views.ClientCaseSearch(_application, new TestStackTest.Commands.ClientCaseSearch_ClickAddNewClientButton()); _report.createReportItem("Click Add New Client Button - Create New Client", start); //the section below is data driven, and contains the older style of assembly, keep it until it can be refactored start = _report.getNow(); ExcelReader excelReader = new ExcelReader(testDataLocation); ExcelReader.ReturnObject dataSet = excelReader.ReadSheet(1, 51); _report.createReportItem("Read Test Data Set - Create New Client", start); start = _report.getNow(); Model_AddClientCase clientDetails = new Model_AddClientCase(dataSet.results[0], dataSet.headers); _report.createReportItem("Create New Client Data Model - Create New Client", start); //set client last name test global to be used in all _clientLastName = clientDetails.mandatoryTextBoxes["lastName"]; start = _report.getNow(); new Complete_AddClientCase(_application, clientDetails); _report.createReportItem("Fill Add New Client Form - Create New Client", start); start = _report.getNow(); new ShutDownSystemUnderTest(_application); _report.createReportItem("Shutdown - Create New Client", start); }