private void HandleSharedStep() { if (IsSharedStep(_currentStep)) { _currentSharedStepsPointer = 0; _currentSharedStep = (ISharedStepReference)_currentStep; ISharedStep ss = _currentSharedStep.FindSharedStep(); TestActionCollection sharedActions = ss.Actions; _currentSharedTestStepResult = CreateSharedStepResult(_currentSharedStep) as ISharedStepResult; _currentSharedSteps.AddRange(sharedActions); _currentStep = _currentSharedSteps[_currentSharedStepsPointer++]; } }
/// <summary> /// Создать нумерованный многоуровневый список Word /// </summary> public void CreateMultiLevelList(Word.Paragraph paragraph, Word.ListTemplate listTemplate, List <ITestCase> testCase, int Index) { // Добавить название тест кейса на первый уровень нумерованного многоуровневого списка paragraph.Range.Text = testCase.ElementAt(Index).Title; paragraph.Range.SetListLevel(1); paragraph.Range.ListFormat.ApplyListTemplateWithLevel(listTemplate, ContinuePreviousList: true, ApplyTo: WdListApplyTo.wdListApplyToSelection, DefaultListBehavior: WdDefaultListBehavior.wdWord10ListBehavior, ApplyLevel: 1); paragraph.Range.InsertParagraphAfter(); // Если в тест кейсе нет Actions if (testCase.ElementAt(Index).Actions.Count == 0) { paragraph.Range.Text = "Тест кейс пуст!"; paragraph.Range.SetListLevel(2); paragraph.Range.ListFormat.ApplyListTemplateWithLevel(listTemplate, ContinuePreviousList: true, ApplyTo: WdListApplyTo.wdListApplyToSelection, DefaultListBehavior: WdDefaultListBehavior.wdWord10ListBehavior, ApplyLevel: 2); paragraph.Range.InsertParagraphAfter(); } ISharedStep sharedStep = null; ISharedStepReference sharedStepReference = null; for (int i = 0; i < testCase.ElementAt(Index).Actions.Count; i++) { sharedStepReference = testCase.ElementAt(Index).Actions.ElementAt(i) as ISharedStepReference; // Добавить общий шаг if (sharedStepReference != null) { // Добавить текст общего шага на второй уровень нумерованного многоуровневого списка sharedStep = sharedStepReference.FindSharedStep(); paragraph.Range.Text = sharedStep.Title + "\t(ОБЩИЙ ШАГ)"; paragraph.Range.SetListLevel(2); paragraph.Range.ListFormat.ApplyListTemplateWithLevel(listTemplate, ContinuePreviousList: true, ApplyTo: WdListApplyTo.wdListApplyToSelection, DefaultListBehavior: WdDefaultListBehavior.wdWord10ListBehavior, ApplyLevel: 2); paragraph.Range.InsertParagraphAfter(); } else { ParameterizedString parametrizedString = new ParameterizedString(((ITestStep)testCase.ElementAt(Index).Actions[i]).Title.ToPlainText()); // Добавить текст Action на второй уровень нумерованного многоуровневого списка paragraph.Range.Text = get_ActionWithParameters(testCase.ElementAt(Index), parametrizedString.ToPlainText()); paragraph.Range.SetListLevel(2); paragraph.Range.ListFormat.ApplyListTemplateWithLevel(listTemplate, ContinuePreviousList: true, ApplyTo: WdListApplyTo.wdListApplyToSelection, DefaultListBehavior: WdDefaultListBehavior.wdWord10ListBehavior, ApplyLevel: 2); paragraph.Range.InsertParagraphAfter(); } } }
private void TestCaseInfoForm_Load(object sender, EventArgs e) { try { label1.Text = testCase.ElementAt(nToolTipIndex).Title; ISharedStep sharedStep = null; ISharedStepReference sharedStepReference = null; List <string> actionsList = new List <string>(); if (testCase.ElementAt(nToolTipIndex).Actions.Count == 0) { actionsList.Add("Тест кейс пуст"); } for (int i = 0; i < testCase.ElementAt(nToolTipIndex).Actions.Count; i++) { sharedStepReference = testCase.ElementAt(nToolTipIndex).Actions.ElementAt(i) as ISharedStepReference; if (sharedStepReference != null) { sharedStep = sharedStepReference.FindSharedStep(); actionsList.Add((i + 1) + ". " + sharedStep.Title + "\t(ОБЩИЙ ШАГ)"); } else { ParameterizedString parametrizedString = new ParameterizedString(((ITestStep)testCase.ElementAt(nToolTipIndex).Actions[i]).Title.ToPlainText()); actionsList.Add((i + 1) + ". " + wordFile.get_ActionWithParameters(testCase.ElementAt(nToolTipIndex), parametrizedString.ToPlainText())); } } listBox1.Items.AddRange(actionsList.ToArray()); } catch { listBox1.Items.Add("В запросе отсутствуют тест кейсы."); } }
private int GenerateTestCase(ITestSuiteEntry testCaseEntry, int startRow) { int currentRowNumber = this.GenerateTestCaseHeader(startRow, testCaseEntry); int startingRowNumber = currentRowNumber; int stepNumber = 1; foreach (ITestAction action in testCaseEntry.TestCase.Actions) { if (action is ISharedStepReference) { ISharedStepReference isr = (ISharedStepReference)action; ISharedStep ss = isr.FindSharedStep(); TestActionCollection sharedActions = ss.Actions; foreach (ITestAction sharedAction in sharedActions) { GenereateTestStepRow(currentRowNumber, stepNumber, (ITestStep)sharedAction); stepNumber++; currentRowNumber++; } } else { GenereateTestStepRow(currentRowNumber, stepNumber, (ITestStep)action); stepNumber++; currentRowNumber++; } } int endingRowNumber = currentRowNumber - 1; _range = _worksheet.get_Range("B" + startingRowNumber, (RefinementWindow.createComments ? "E" : "D") + endingRowNumber); DrawAllSolidBorders(_range, 0); return(currentRowNumber + 1); }
private ITestActionResult CreateSharedStepResult(ISharedStepReference testStep) { return(_iteration.CreateSharedStepResult(testStep.Id, testStep.FindSharedStep().Id)); }