public void InsertTest(object sender, EventArgs args) { TextEntry dataEntry = new TextEntry(); dataEntry.ShowDialog(); TestCase driverId = null; SubSequence driverIdSubSequence = Item.Frame.findSubSequence("IN Driver id"); foreach (TestCase testCase in driverIdSubSequence.TestCases) { if (testCase.Name == "IN Driver Id") { driverId = testCase; break; } } if (driverId != null) { TestCase duplicate = driverId.Duplicate() as TestCase; if (duplicate != null) { duplicate.Name = "IN " + dataEntry.Value; foreach (Step step in duplicate.Steps) { foreach (SubStep subStep in step.SubSteps) { foreach (Action action in subStep.Actions) { action.ExpressionText = action.ExpressionText.Replace("DriverId", dataEntry.Value); } foreach (Expectation expectation in subStep.Expectations) { expectation.ExpressionText = expectation.ExpressionText.Replace("DriverId", dataEntry.Value); } } } } Item.appendTestCases(duplicate); } }