internal static void CreateTestsWithSharedSteps(string tFSUri, Microsoft.Office.Interop.Excel.Application excel, string path, TextBox textBox1, TextBox URL, TextBox projectName) { tFSUri = "https://" + URL.Text; int currentRow = 2; while (true) { int parentId = ExcelWork.GetParentId(currentRow, excel, path); if (parentId == 0) { textBox1.AppendText("\r\n No parent item found, ending import \r\n"); break; } SharedStepsObject sharedStepObject = new SharedStepsObject { uri = "https://" + URL.Text, project = Program.GetTeamProject(tFSUri, projectName.Text), testedWorkItem = Program.GetWorkItem(tFSUri, parentId), title = ExcelWork.GetTitle(currentRow, excel, path), description = ExcelWork.GetDescrition(currentRow, excel, path), paramExcelFile = ExcelWork.GetParamFileName(currentRow, excel, path), automationValue = ExcelWork.GetAutomationValue(currentRow, excel, path), paramSheet = ExcelWork.GetParamSheetName(currentRow, excel, path) }; currentRow++; sharedStepObject.actionSteps = ExcelWork.GetSteps(currentRow, excel, path).ToArray(); sharedStepObject.results = ExcelWork.GetResults(currentRow, sharedStepObject.actionSteps.Count(), excel, path).ToArray(); currentRow = currentRow + sharedStepObject.actionSteps.Count(); if (sharedStepObject.paramExcelFile != "") { CreateIterativeCases(sharedStepObject, excel, textBox1, parentId); } else { textBox1.AppendText("\r\n Case started for " + sharedStepObject.title); sharedStepObject.id = Program.CreateSharedStep(sharedStepObject); var resultTestCase = Program.CreateNewTestCase(sharedStepObject, parentId); textBox1.AppendText("\r\n Case created for " + sharedStepObject.title + "\r\n"); } } }
public static void CreateIterativeCases(SharedStepsObject sharedStepObject, Microsoft.Office.Interop.Excel.Application excel, TextBox textBox1, int parentId) { string paramPath = Form1.paramPath.ToString() + sharedStepObject.paramExcelFile; sharedStepObject.paramTable = ExcelWork.GetParams(excel, paramPath, sharedStepObject.paramSheet.ToString()); string titleHold = sharedStepObject.title; int NumOfActions = sharedStepObject.actionSteps.Count(); string[] holdSteps = new string[NumOfActions]; for (int i = 0; i < NumOfActions; i++) { holdSteps[i] = sharedStepObject.actionSteps[i]; } string[] holdResults = new string[NumOfActions]; for (int i = 0; i < NumOfActions; i++) { holdResults[i] = sharedStepObject.results[i]; } for (int iteration = 0; iteration < sharedStepObject.paramTable.Rows.Count; iteration++) { sharedStepObject.title = titleHold + " - " + (iteration + 1).ToString(); textBox1.AppendText("\r\n Case started for " + sharedStepObject.title); sharedStepObject.actionSteps = ReturnStepsReplaceParams(textBox1, sharedStepObject.actionSteps, sharedStepObject, iteration); sharedStepObject.results = ReturnStepsReplaceParams(textBox1, sharedStepObject.results, sharedStepObject, iteration); sharedStepObject.id = Program.CreateSharedStep(sharedStepObject); var resultTestCase = Program.CreateNewTestCase(sharedStepObject, parentId); textBox1.AppendText("\r\n Case created for " + sharedStepObject.title + "\r\n"); //reset steps and results for (int i = 0; i < NumOfActions; i++) { sharedStepObject.actionSteps[i] = holdSteps[i]; } for (int i = 0; i < NumOfActions; i++) { sharedStepObject.results[i] = holdResults[i]; } } }
public static string[] GetSharedStepsForE2E(Microsoft.Office.Interop.Excel.Application excel, SharedStepsObject sharedStepsObject) { ExcelWork.GetStepsForE2E(1, excel, sharedStepsObject.paramSheet); return(sharedStepsObject.actionSteps); }