public void Configure(TestConfiguration aTestConfiguration, TestEnvironment aTestEnvironment) { var testDiscovery = new TestDiscovery(aTestEnvironment.CustomArguments); var testExecution = new TestExecution(aTestEnvironment.CustomArguments); aTestConfiguration.Conventions.Add(testDiscovery, testExecution); }
public SaveTestExecutionResponse FinishTest(long executionId) { TestExecution execution = Repository.OneTestExecutionWhere(c => c.Id == executionId); execution.FinishedTime = DateTime.UtcNow; return(SaveTestExecution(execution)); }
//This method executes before the test. public override void BeforeExecute() { using (TestExecution.CreateTestCaseGroup("Preparation")) { using (TestExecution.CreateTestStepGroup("Sign in")) { Console.WriteLine("\n************************"); Console.WriteLine("\nWelcome, you are executing Test: '" + this.ToString() + "' for site " + Config.SITE_DST_URL); Console.WriteLine("\n Time: " + startTime.ToString()); Console.WriteLine("\n************************"); Browser.StartingUrl = Config.SITE_DST_URL; PxLogin LoginPage = new PxLogin(); String login = Config.SITE_DST_LOGIN; String company = ""; int location = login.IndexOf("@"); if (location > 0) { company = login.Substring(location + 1); login = login.Substring(0, location); } LoginPage.Username.Type(login); LoginPage.Password.Type(Config.SITE_DST_PASSWORD); if (company != "") { LoginPage.CompanyId.SelectValue(company); } LoginPage.SignIn.Click(); Console.WriteLine("You have successfully logged into Acumatica."); } } }
public override void TestFinished(object sender, TestEventArgs <UnitTestMethod> args) { UnitTestMethod test = args.Test.CopyAs <UnitTestMethod>(); TestExecution testExecution = SetTestExecution(test); TestReportService.FinishTest(testExecution.Id); }
public ZumoTest(string name, TestExecution execution) { this.Name = name; this.Data = new Dictionary <string, object>(); this.logs = new List <string>(); this.execution = execution; this.Status = TestStatus.NotRun; }
public override void TestPassed(object sender, TestEventArgs <UnitTestMethod> args) { UnitTestMethod test = args.Test.CopyAs <UnitTestMethod>(); TestExecution testExecution = SetTestExecution(args); testExecution.Passed = true; TestReportService.SaveTestExecution(testExecution); }
public ZumoTest(string name, TestExecution execution) { this.Name = name; this.Data = new Dictionary<string, object>(); this.logs = new List<string>(); this.execution = execution; this.Status = TestStatus.NotRun; }
public async Task <int> Handle(CreateTestExecutionCommand request, CancellationToken cancellationToken) { var ste = await _context.StageTests.Where(st => st.TestId == request.TestId && st.StageId == request.StageId).FirstOrDefaultAsync(); //Map request to entity var entity = new TestExecution { //TestId = request.TestId, //StageId = request.StageId, }; if (ste != null) { ste.TestExecutions = new List <TestExecution>() { entity }; } else { var test = await _context.Tests.FindAsync(request.TestId); if (test == null) { throw new NotFoundException(nameof(test), request.TestId); } var stage = await _context.Stages.FindAsync(request.StageId); if (stage == null) { throw new NotFoundException(nameof(stage), request.StageId); } var stageTestEntity = new StageTest { TestId = request.TestId, StageId = request.StageId, TestExecutions = new List <TestExecution>() { entity } }; _context.StageTests.Add(stageTestEntity); } //_context.TestExecutions.Add(entity); //_context.StageTests.Add(stageTestEntity); await _context.SaveChangesAsync(cancellationToken); return(entity.Id); }
public SaveTestExecutionResponse Pass(int summaryId, string suiteTitle, string testTitle) { TestDefinition testDefinition = GetOrCreateTestDefinition(suiteTitle, testTitle); TestExecution execution = new TestExecution { TestSuiteExecutionSummaryId = summaryId, TestDefinitionId = testDefinition.Id, Passed = true }; return(SaveTestExecution(execution)); }
public SaveTestExecutionResponse Fail(int summaryId, string suiteTitle, string testTitle, string error) { TestDefinition testDefinition = GetOrCreateTestDefinition(suiteTitle, testTitle); TestExecution execution = new TestExecution { TestSuiteExecutionSummaryId = summaryId, TestDefinitionId = testDefinition.Id, Passed = false, Exception = error }; return(SaveTestExecution(execution)); }
public override void TestFailed(object sender, TestExceptionEventArgs args) { UnitTestMethod test = args.TestMethod.CopyAs <UnitTestMethod>(); TestExecution testExecution = SetTestExecution(test); testExecution.Passed = false; Exception ex = args.Exception?.GetInnerException(); testExecution.Exception = ex?.Message; testExecution.StackTrace = ex?.StackTrace; TestReportService.SaveTestExecution(testExecution); }
private void WriteTestExecution(TestExecution testExecution) { WriteTestExecution( testExecution.TelemetryInfo.Gen0, testExecution.TelemetryInfo.Gen1, testExecution.TelemetryInfo.Gen2, testExecution.TelemetryInfo.CPUUsage, testExecution.TelemetryInfo.TotalOfMemoryKb, testExecution.TelemetryInfo.ExecutionTime, testExecution.TelemetryInfo.Index, testExecution.Success); }
public RetrieveTestExecutionResponse RetrieveTestExecutionById(long id) { try { TestExecution retrieved = Repository.Retrieve <TestExecution>(id); return(new RetrieveTestExecutionResponse { Success = true, Data = retrieved, CreateStatus = CreateStatus.Existing }); } catch (Exception ex) { return(new RetrieveTestExecutionResponse { Success = false, Message = ex.Message }); } }
public SaveTestExecutionResponse SaveTestExecution(TestExecution execution) { try { Meta.SetAuditFields(execution); TestExecution exec = Repository.Save(execution); return(new SaveTestExecutionResponse { Success = true, Data = exec }); } catch (Exception ex) { return(new SaveTestExecutionResponse { Success = false, Message = ex.Message }); } }
public void GetEmployeesQualificationsUnderACompany() { List <EmployeeModel> tasksList = new List <EmployeeModel>(); TestExecution testExecute = new TestExecution(); string[] ColumnList = new string[] { Constants.USERID, Constants.COMPANY_ID, Constants.SUSPENDED_QUALIFICATION, Constants.DISQUALIFIED_QUALIFICATION, Constants.ROLE, Constants.EMPLOYEE_NAME, Constants.TOTAL_EMPLOYEES, Constants.ASSIGNED_QUALIFICATION, Constants.COMPLETED_QUALIFICATION, Constants.IN_DUE_QUALIFICATION, Constants.PAST_DUE_QUALIFICATION, Constants.IN_COMPLETE_QUALIFICATION, Constants.LOCK_OUT_COUNT }; EmployeeModel taskFilter1 = testExecute.CreateFields(Constants.CONTRACTOR_COMPANY, "4065", "=", ""); tasksList.Add(taskFilter1); TaskResponse taskResponse = testExecute.ExecuteTests(2288, 331535, ColumnList, Constants.OQ_DASHBOARD, tasksList); List <TaskModel> tasksResponse = taskResponse.Tasks; Assert.IsTrue(tasksResponse.Count > 0); Assert.AreNotEqual("", tasksResponse[0].UserId); Assert.AreNotEqual(null, tasksResponse[0].LockoutCount); }
public void GetLockOutForACompanyWithoutLockOutData() { List <EmployeeModel> tasksList = new List <EmployeeModel>(); TestExecution testExecute = new TestExecution(); string[] ColumnList = new string[] { Constants.TASK_CODE, Constants.TASK_NAME, Constants.EMPLOYEE_NAME, Constants.COURSE_EXPIRATION_DATE, "REASON" }; EmployeeModel taskFilter1 = testExecute.CreateFields(Constants.CONTRACTOR_COMPANY, "4738", "=", ""); EmployeeModel taskFilter2 = testExecute.CreateFields(Constants.LOCKOUT_COUNT, "true", "=", "AND"); tasksList.Add(taskFilter1); tasksList.Add(taskFilter2); TaskResponse taskResponse = testExecute.ExecuteTests(2288, 331535, ColumnList, Constants.OQ_DASHBOARD, tasksList); List <TaskModel> tasksResponse = taskResponse.Tasks; Assert.IsTrue(tasksResponse.Count == 0); }
public void GetTasksProgressForAWorkbook() { List <EmployeeModel> wbList = new List <EmployeeModel>(); TestExecution testExecute = new TestExecution(); string[] ColumnList = new string[] { Constants.USERID, Constants.WORKBOOK_ID, Constants.TASK_ID, Constants.TASK_CODE, Constants.TASK_NAME, Constants.COMPLETED_TASK, Constants.INCOMPLETE_TASK, Constants.TOTAL_TASK }; EmployeeModel wbFilter1 = testExecute.CreateFields(Constants.USERID, "384666", "=", ""); EmployeeModel wbFilter2 = testExecute.CreateFields(Constants.WORKBOOK_ID, "22", "=", "AND"); wbList.Add(wbFilter1); wbList.Add(wbFilter2); WorkbookResponse wbResponse = testExecute.ExecuteTests(2288, 331535, ColumnList, Constants.WORKBOOK_DASHBOARD, wbList); List <WorkbookModel> workbookList = wbResponse.Workbooks; Assert.IsTrue(workbookList.Count > 0); }
public void GetDashboardForAUser() { List <EmployeeModel> wbList = new List <EmployeeModel>(); TestExecution testExecute = new TestExecution(); string[] ColumnList = new string[] { Constants.USERID, Constants.SUPERVISOR_ID, Constants.EMPLOYEE_NAME, Constants.ROLE, Constants.ASSIGNED_WORKBOOK, Constants.WORKBOOK_DUE, Constants.PAST_DUE_WORKBOOK, Constants.COMPLETED_WORKBOOK, Constants.TOTAL_EMPLOYEES }; EmployeeModel wbFilter1 = testExecute.CreateFields(Constants.SUPERVISOR_ID, "331535", "=", ""); EmployeeModel wbFilter2 = testExecute.CreateFields(Constants.CURRENT_USER, "331535", "=", "AND"); wbList.Add(wbFilter1); wbList.Add(wbFilter2); WorkbookResponse wbResponse = testExecute.ExecuteTests(2288, 331535, ColumnList, Constants.WORKBOOK_DASHBOARD, wbList); List <WorkbookModel> workbookList = wbResponse.Workbooks; Assert.IsTrue(workbookList.Count > 0); }
public virtual void ResetSite(InputVars myVars) { Console.WriteLine("- UnPublish Customizations"); using (TestExecution.CreateTestCaseGroup("UnPublish Customizations")) { string dir = Directory.GetCurrentDirectory(); CustomizationMgr myMgr = new CustomizationMgr(); myMgr.OpenScreen(); myMgr.ActionUndoPublish(); } using (TestExecution.CreateTestCaseGroup("Restore fresh database")) { Console.WriteLine("- Restore SQL DB"); DatabaseOperations db = new DatabaseOperations(); db.RestoreDB(myVars.sQLServerName, myVars.databaseName, myVars.backupLocation); } using (TestExecution.CreateTestStepGroup("Sign in")) { Console.WriteLine("Logging into " + Config.SITE_DST_URL); Browser.StartingUrl = Config.SITE_DST_URL; PxLogin LoginPage = new PxLogin(); String login = Config.SITE_DST_LOGIN; String company = ""; int location = login.IndexOf("@"); if (location > 0) { company = login.Substring(location + 1); login = login.Substring(0, location); } LoginPage.Username.Type(login); LoginPage.Password.Type(Config.SITE_DST_PASSWORD); if (company != "") { LoginPage.CompanyId.SelectValue(company); } LoginPage.SignIn.Click(); Console.WriteLine("You have successfully logged into Acumatica."); } }
public static bool VerifyVisualTree(UIElement root, string masterFilePrefix, Theme theme = Theme.None, IPropertyValueTranslator translator = null, IFilter filter = null, IVisualTreeLogger logger = null) { VisualTreeLog.LogInfo("VerifyVisualTree for theme " + theme.ToString()); TestExecution helper = new TestExecution(translator, filter, logger, AlwaysLogMasterFile); if (theme == Theme.None) { helper.DumpAndVerifyVisualTree(root, masterFilePrefix); } else { List <ElementTheme> themes = new List <ElementTheme>(); if (theme == Theme.Dark) { themes.Add(ElementTheme.Dark); } else if (theme == Theme.Light) { themes.Add(ElementTheme.Light); } else if (theme == Theme.All) { themes = new List <ElementTheme>() { ElementTheme.Dark, ElementTheme.Light }; } foreach (var requestedTheme in themes) { string themeName = requestedTheme.ToString(); VisualTreeLog.LogInfo("Change RequestedTheme to " + themeName); ChangeRequestedTheme(root, requestedTheme); helper.DumpAndVerifyVisualTree(root, masterFilePrefix + "_" + themeName, "DumpAndVerifyVisualTree for " + themeName); } } if (helper.HasError()) { Verify.Fail(helper.GetTestResult(), "Test Failed"); return(false); } return(true); }
public void GetInDueQualificationsForACompany() { List <EmployeeModel> tasksList = new List <EmployeeModel>(); TestExecution testExecute = new TestExecution(); string[] ColumnList = new string[] { Constants.TASK_CODE, Constants.TASK_NAME, Constants.EMPLOYEE_NAME, Constants.COURSE_EXPIRATION_DATE, "REASON" }; EmployeeModel taskFilter1 = testExecute.CreateFields(Constants.CONTRACTOR_COMPANY, "4065", "=", ""); EmployeeModel taskFilter2 = testExecute.CreateFields(Constants.IN_DUE, "30", "=", "AND"); tasksList.Add(taskFilter1); tasksList.Add(taskFilter2); TaskResponse taskResponse = testExecute.ExecuteTests(2288, 331535, ColumnList, Constants.OQ_DASHBOARD, tasksList); List <TaskModel> tasksResponse = taskResponse.Tasks; Assert.IsTrue(tasksResponse.Count > 0); Assert.AreNotEqual(null, tasksResponse[0].ExpirationDate); }
public void GetQualifiedForACompany() { List <EmployeeModel> tasksList = new List <EmployeeModel>(); TestExecution testExecute = new TestExecution(); string[] ColumnList = new string[] { Constants.TASK_CODE, Constants.TASK_NAME, Constants.EMPLOYEE_NAME, Constants.COURSE_EXPIRATION_DATE, "REASON" }; EmployeeModel taskFilter1 = testExecute.CreateFields(Constants.CONTRACTOR_COMPANY, "4065", "=", ""); EmployeeModel taskFilter2 = testExecute.CreateFields(Constants.COMPLETED, "true", "=", "AND"); tasksList.Add(taskFilter1); tasksList.Add(taskFilter2); TaskResponse taskResponse = testExecute.ExecuteTests(2288, 331535, ColumnList, Constants.OQ_DASHBOARD, tasksList); List <TaskModel> tasksResponse = taskResponse.Tasks; Assert.IsTrue(tasksResponse.Count > 0); Assert.AreNotEqual("", tasksResponse[0].UserId); Assert.AreEqual(Constants.QUALIFIED, tasksResponse[0].Status.ToUpper()); }
public ZumoTest(string name, TestExecution execution, params string[] requiredRuntimeFeatures) { this.Name = name; this.Data = new Dictionary<string, object>(); this.CanRunUnattended = true; this.logs = new List<string>(); this.execution = execution; this.Status = TestStatus.NotRun; this.runtimeFeatures = new List<string>(); if (requiredRuntimeFeatures.Length > 0) { foreach (string requiredRuntimeFeature in requiredRuntimeFeatures) { if (requiredRuntimeFeature != null) { this.runtimeFeatures.Add(requiredRuntimeFeature); } } } }
public ZumoTest(string name, TestExecution execution, params string[] requiredRuntimeFeatures) { this.Name = name; this.Data = new Dictionary <string, object>(); this.CanRunUnattended = true; this.logs = new List <string>(); this.execution = execution; this.Status = TestStatus.NotRun; this.runtimeFeatures = new List <string>(); if (requiredRuntimeFeatures.Length > 0) { foreach (string requiredRuntimeFeature in requiredRuntimeFeatures) { if (requiredRuntimeFeature != null) { this.runtimeFeatures.Add(requiredRuntimeFeature); } } } }
public void GetOQDashboardForAUser() { List <EmployeeModel> tasksList = new List <EmployeeModel>(); TestExecution testExecute = new TestExecution(); string[] ColumnList = new string[] { Constants.COMPANY_ID, Constants.COMPANY_NAME, Constants.SUSPENDED_QUALIFICATION, Constants.DISQUALIFIED_QUALIFICATION, Constants.ASSIGNED_COMPANY_QUALIFICATION, Constants.COMPLETED_COMPANY_QUALIFICATION, Constants.IN_COMPLETE_COMPANY_QUALIFICATION, Constants.PAST_DUE_COMPANY_QUALIFICATION, Constants.IN_DUE_COMPANY_QUALIFICATION, Constants.TOTAL_COMPANY_EMPLOYEES, Constants.LOCK_OUT_COUNT }; EmployeeModel taskFilter1 = testExecute.CreateFields(Constants.USERID, "331535", "=", ""); tasksList.Add(taskFilter1); TaskResponse taskResponse = testExecute.ExecuteTests(2288, 331535, ColumnList, Constants.OQ_DASHBOARD, tasksList); List <TaskModel> tasksResponse = taskResponse.Tasks; //int userIndex = tasksResponse.FindIndex(x => x.UserId.ToString() == supervisor_company_id); //Assert.IsTrue(userIndex >= 0); Assert.IsTrue(tasksResponse.Count > 0); Assert.AreNotEqual("", tasksResponse[0].CompanyName); Assert.AreNotEqual(null, tasksResponse[0].LockoutCount); Assert.IsTrue(tasksResponse[0].TotalEmployees >= 0); }
public RetrieveTestExecutionResponse RetrieveTestExecutionByUuid(string uuid) { try { TestExecution queried = Repository.Query <TestExecution>(Query.Where("Uuid") == uuid).FirstOrDefault(); if (queried == null) { Args.Throw <ArgumentException>("TestExecution with the specified Uuid was not found: {0}", uuid); } TestExecution retrieved = Repository.Retrieve <TestExecution>(queried.Id); return(new RetrieveTestExecutionResponse { Success = true, Data = retrieved }); } catch (Exception ex) { return(new RetrieveTestExecutionResponse { Success = false, Message = ex.Message }); } }
public void RepititionsDetailForUnattemptedTask() { List <EmployeeModel> wbList = new List <EmployeeModel>(); TestExecution testExecute = new TestExecution(); string[] ColumnList = new string[] { Constants.NUMBER_OF_ATTEMPTS, Constants.STATUS, Constants.LAST_ATTEMPT_DATE, Constants.LOCATION, Constants.EVALUATOR_NAME, Constants.COMMENTS }; EmployeeModel wbFilter1 = testExecute.CreateFields(Constants.USERID, "384666", "=", ""); EmployeeModel wbFilter2 = testExecute.CreateFields(Constants.STATUS, Constants.COMPLETED, "=", "AND"); EmployeeModel wbFilter4 = testExecute.CreateFields(Constants.WORKBOOK_ID, "22", "=", "AND"); EmployeeModel wbFilter3 = testExecute.CreateFields(Constants.TASK_ID, "32934", "=", "AND"); wbList.Add(wbFilter1); wbList.Add(wbFilter2); wbList.Add(wbFilter3); wbList.Add(wbFilter4); WorkbookResponse wbResponse = testExecute.ExecuteTests(2288, 331535, ColumnList, Constants.WORKBOOK_DASHBOARD, wbList); List <WorkbookModel> workbookList = wbResponse.Workbooks; Assert.IsTrue(workbookList.Count == 0); }
public void GetAllQualificationsForASupervisor() { List <EmployeeModel> tasksList = new List <EmployeeModel>(); TestExecution testExecute = new TestExecution(); string[] ColumnList = new string[] { Constants.TASK_CODE, Constants.TASK_NAME, Constants.EMPLOYEE_NAME, Constants.ASSIGNED_DATE, "REASON" }; EmployeeModel taskFilter1 = testExecute.CreateFields(Constants.CONTRACTOR_COMPANY, "4065", "=", ""); EmployeeModel taskFilter2 = testExecute.CreateFields(Constants.ADMIN_ID, "331535", "=", "AND"); EmployeeModel taskFilter3 = testExecute.CreateFields(Constants.SUPERVISOR_ID, "370043", "=", ""); EmployeeModel taskFilter4 = testExecute.CreateFields(Constants.ASSIGNED, "true", "=", "AND"); tasksList.Add(taskFilter1); tasksList.Add(taskFilter2); tasksList.Add(taskFilter3); tasksList.Add(taskFilter4); TaskResponse taskResponse = testExecute.ExecuteTests(2288, 331535, ColumnList, Constants.OQ_DASHBOARD, tasksList); List <TaskModel> tasksResponse = taskResponse.Tasks; Assert.IsTrue(tasksResponse.Count > 0); Assert.AreEqual(370043, tasksResponse[0].UserId); }
//This method executes after the test. public override void AfterExecute() { using (TestExecution.CreateTestCaseGroup("Finalization")) { using (TestExecution.CreateTestStepGroup("Sign out and close the browser.")) { //Companies Companies = new Companies(); //Companies.OpenScreen(); //Companies.LogOut(); DateTime endTime = DateTime.Now; int seconds = (int)endTime.Subtract(startTime).TotalSeconds; int minutes = seconds / 60; seconds = seconds % 60; Console.WriteLine("\n************************"); Console.WriteLine("Test End. Logging out."); Console.WriteLine("\n Time: " + endTime.ToString()); Console.WriteLine("\n Elapsed Time: " + minutes.ToString() + " mins & " + seconds.ToString() + " seconds"); Console.WriteLine("\n************************"); Browser.Stop(); } } }
public void Scenario(TestExecution testExecution) { var featureBuilder = new StringBuilder(); featureBuilder.AppendLine(string.Format(SCENARIO_FORMAT, testExecution.Summary, testExecution.IssueKey)); string description = Regex.Replace(testExecution.IssueDescription, HTML_TAG_PATTERN, ""); description = description.Substring(0, description.IndexOf(END_OF_TEST)); featureBuilder.AppendLine(description); List <IEventListener> eventListeners = new List <IEventListener>(); eventListeners.Add(EventListeners.ColorfulConsoleOutputEventListener()); eventListeners.Add(new LoggingStoryReporter()); if (Settings.UpdateExecutionStatus) { eventListeners.Add(new ZapiStoryReporter(ZapiClient, testExecution.Id, Settings.PassExecutionStatus, Settings.FailExecutionStatus, Settings.unexecutedStatus, Settings.workInProgress)); } eventListeners.Add(new InconclusiveStoryReporter()); featureBuilder.ToString().ExecuteText(typeof(GeneralSteps).Assembly, eventListeners.ToArray()); }
public void addNewTestExecution() { int totalerrorcount = 0; int totalwarningcount = 0; int totalsuccesscount = 0; int totalfailedcount = 0; int totalblockedcount = 0; String host = "UNKNOWN"; String user = "******"; String osversion = "UNKNOWN"; String language = "EN-US"; String screenresolution = "UNKNOWN"; String timestamp = "UNKNOWN"; String duration = "UNKNOWN"; String type = "root"; try { user = Environment.UserName; host = Environment.MachineName; osversion = Environment.OSVersion.VersionString; screenresolution = System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Width.ToString() + "X" + System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Height.ToString(); DateTime date = DateTime.Now; timestamp = date.ToString("MM/dd/yyyy h:mm:ss aa"); } catch (Exception e) { Console.WriteLine(e.ToString()); } testExecution = new TestExecution(user, host, osversion, language, screenresolution, timestamp, duration, type, totalerrorcount, totalwarningcount, totalsuccesscount, totalfailedcount, totalblockedcount); }
public override void Initialize(TestExecution execution) { }
public override void Initialize(TestExecution execution) { execution.AfterAssemblyInitialize += AssemblyInitialize; }
/// <summary> /// Initialize any resources or objects you may need for the test to run. /// You can also wire up event handlers you may want to intercept /// </summary> /// <param name="Execution"></param> public override void Initialize(TestExecution Execution) { //TODO: Wire up event handlers for test events if needed }
static void Main(string[] args) { TestExecution TestExe = new TestExecution(); TestExe.RunTestCase(); }