private void AddToTestCaseTable(TestCaseObject tcase) { //running the command SqlCommand command = new SqlCommand(); try { connection.Open(); command.CommandTimeout = 60; command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "spAddTestCaseData"; //adding the values to the parameter command.Parameters.Add("testName", SqlDbType.NVarChar, 50).Value = tcase.TestName; command.Parameters.Add("testStatusId", SqlDbType.BigInt).Value = tcase.TestStatus; command.Parameters.Add("imagePath", SqlDbType.NVarChar, 256).Value = tcase.ImagePath; command.Parameters.Add("createdDate", SqlDbType.DateTime).Value = tcase.CreatedDate; command.Parameters.Add("createdBy", SqlDbType.NVarChar, 50).Value = tcase.CreatedBy; command.Parameters.Add("testRunId", SqlDbType.BigInt, 50).Value = tcase.TestRunId; tcase.TestCaseId = int.Parse(command.ExecuteScalar().ToString()); connection.Close(); } catch (SqlException e) { Print(e.StackTrace, "AddToTestCaseTable"); } catch (InvalidOperationException e) { Print(e.StackTrace, "AddToTestCaseTable"); } }
/// <summary> This method is going to add documents to batch review and then run through and both add a document to an existing document and attribute a new one.</summary> public void BatchReview(TestCaseObject tcase) { pt(i); method = MethodBase.GetCurrentMethod().Name; AddDocsToCollector(); window = m.Locate(By.Id("frmIntactMain")); handler.GetActiveWindow(); var mainIntact = handler.WindowProcess; window = m.Locate(By.Id("radPanelBar1"), window); window = m.Locate(By.Id("pageIntact"), window); window = m.Locate(By.Id("lstIntact"), window); m.Click(By.Name("Batch Review"), window); Thread.Sleep(1000); m.Click(By.Id("6")); Thread.Sleep(1000); m.Click(By.Id("6")); //attribute test from batch review... BatchCreate(tcase); //add to document test from batch review... AddDocBatchReview(); m.Click(By.Id("btnClose")); handler.SetAsActiveWindow(mainIntact); pt(i); }
public void BatchCreate(TestCaseObject tcase) { method = MethodBase.GetCurrentMethod().Name; Print("Started", method); Thread.Sleep(6000); pt(i); window = m.Locate(By.Id("frmBatchReview")); if (m.IsElementPresent(By.Name("Maximize"), window)) { m.Click(By.Name("Maximize"), window); } pt(i); handler.GetActiveWindow(); pt(i); m.Click(By.Id("btnAttribute"), window); Thread.Sleep(2000); DocumentObject document = new DocumentObject(); m.Click(By.Id("lblType")); document.Type = "test"; document.Definition = "def"; action.MoveByOffset(30, 0).Click().SendKeys(document.Type).Build().Perform(); m.Click(By.Id("lblType")); action.MoveByOffset(30, 27).Click().SendKeys(document.Definition).Build().Perform(); //adding the metadata values m.Click(By.Id("lblType")); var date = DateTime.Now.Date; var num = new Random().Next(); document.MetaData.AddData(date); document.MetaData.AddData(num); document.MetaData.AddData(document.DocumentId); action.MoveByOffset(150, 240).Click().SendKeys(date.ToString()). MoveByOffset(0, 20).Click().SendKeys(num.ToString()). MoveByOffset(0, 20).Click().SendKeys(document.DocumentId).Build().Perform(); //add author, expiration date, and summary m.Click(By.Id("lblType")); document.Author = "BATCH AUTHOR"; document.Summary = "BATCH SUMMARY"; action.MoveByOffset(170, 80).Click().SendKeys("1/1/2050").MoveByOffset(0, 20).Click().SendKeys(document.Author). MoveByOffset(0, 40).Click().SendKeys(document.Summary).Build().Perform(); //save and quit m.Click(By.Id("btnSave")); m.Click(By.Id("btnClose")); pt(i); Print("Finished the document addition", method); tcase.AddDocument(document); new SQLDataHandler().ValidateDocumentAdd(document); pt(i); }
/// <summary> /// Adds a Test Case to the Run and communicates the status of the Test Case to the Test Run /// </summary> public void AddTestCase(TestCaseObject tcase) { tcase.CreatedBy = CreatedBy; if (tcase.TestStatus == 2) { TestsPassed++; } else { TestsFailed++; } TestCases.Add(tcase); }
///<summary> ///<para>Creation of Documents</para> ///<para>numOfDocs: specifies how many to create, isPDF: pdf or tif,docPath: allows you to specify the directory of docs, default is set in config, filenumber: which document in a certain directory </para> ///</summary> public void CreateDocument(TestCaseObject tcase, int?numOfDocs = 1, bool isPDF = true, string docPath = "", int?fileNumber = 0) { method = MethodBase.GetCurrentMethod().Name; Print("Started", method); //check if maximized. This is slowing down the add document process window = m.Locate(By.Id("frmIntactMain")); if (m.IsElementPresent(By.Name("Maximize"), window)) { m.Click(By.Name("Maximize"), window); } //WindowProcessHandler wh = new WindowProcessHandler(); //wh.GetActiveWindow(); //var mainIntact = wh.WindowProcess; for (int i = 0; i < numOfDocs; i++) { DocumentObject document = new DocumentObject(); m.Click(By.Name("Add Document")); Thread.Sleep(3000); m.Click(By.Id("lblType")); document.Type = "test"; document.Definition = "def"; action.MoveByOffset(30, 0).Click().SendKeys(document.Type).Build().Perform(); m.Click(By.Id("lblType")); action.MoveByOffset(30, 27).Click().SendKeys(document.Definition).Build().Perform(); //m.Click(By.Id("lblType")); // action.MoveByOffset(30, 56).Click().SendKeys(document.DocumentId).Build().Perform(); //add document button (+ icon) m.Click(By.Id("lblType")); action.MoveByOffset(29, -34).Build().Perform(); Thread.Sleep(1000); action.DoubleClick().MoveByOffset(20, 60).Click().Build().Perform(); FileExplorer(isPDF, docPath, fileNumber); //adding the metadata values m.Click(By.Id("lblType")); var date = DateTime.Now.Date; var num = new Random().Next(); document.MetaData.AddData(date); document.MetaData.AddData(num); document.MetaData.AddData(document.DocumentId); action.MoveByOffset(150, 240).Click().SendKeys(date.ToString()). MoveByOffset(0, 20).Click().SendKeys(num.ToString()). MoveByOffset(0, 20).Click().SendKeys(document.DocumentId).Build().Perform(); //add author, expiration date, and summary m.Click(By.Id("lblType")); document.Author = "TEST AUTHOR"; document.Summary = "TEST SUMMARY"; action.MoveByOffset(170, 80).Click().SendKeys("1/1/2050").MoveByOffset(0, 20).Click().SendKeys(document.Author). MoveByOffset(0, 40).Click().SendKeys(document.Summary).Build().Perform(); //save and quit m.Click(By.Id("btnSave")); window = m.Locate(By.Name("File Document")); m.Click(By.Name("Yes"), window); m.Click(By.Name("DEFAULT DEF")); m.Click(By.Name("&OK")); m.Click(By.Id("btnClose")); Print("Finished the document addition", method); Thread.Sleep(5000); tcase.AddDocument(document); new SQLDataHandler().ValidateDocumentAdd(document); //wh.SetAsActiveWindow(mainIntact); // weird bug where if you don't choose a definition and choose to file now it doesn't keep the intact main window up. } }