public void GenerateScenario() { CTestContainer container = new CTestContainer(); container.description = "Test container"; for (int testIndex = 1; testIndex <= 3; testIndex++) { CTest test = new CTest("Test_1." + testIndex, "Test descriptor #" + testIndex); for (int stepIndex = 1; stepIndex < 2; stepIndex++) { string title = "Step " + testIndex + "." + stepIndex; CStep step = new CStep( title, "Action description for " + title, "Check description for " + title ); for (int actionIndex = 1; actionIndex < 10; actionIndex++) { CInstruction action = new CInstrForce(); CVariableBool var = new CVariableBool("Var" + actionIndex, "Section1/ENV", "/path/to/application" + actionIndex, "true"); action.data = var; step.actions.Add(action); } for (int checkIndex = 1; checkIndex < 10; checkIndex++) { CInstruction action = new CInstrTest(); CVariableBool var = new CVariableBool("Var" + checkIndex, "Section2/ENV", "/path/to/application" + checkIndex, "true"); action.data = var; step.checks.Add(action); } test.Add(step); } container.Add(test); } string URIFilename = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase) + Path.DirectorySeparatorChar + "templates" + Path.DirectorySeparatorChar + "ST-TestStand4" + Path.DirectorySeparatorChar; Uri uri = new Uri(URIFilename); TestStandGen.TestStandGen.genSequence(container, "C:\\macros_alstom\\test\\genTest.seq", uri.LocalPath); Assert.IsTrue(true); }
private CInstruction detectAndBuildInstruction(string Target, string Location, string Path, object CellValue, TableTypes typeOfTable) { CInstruction Instruction; string CellValueStr = Convert.ToString(CellValue); List<char> detectedChars = extractSpecialProperties(ref Target, ref CellValueStr); if(detectedChars.Count > 0) logger.Debug(String.Format("Found {0} special properties.", detectedChars.Count)); if (typeOfTable == TableTypes.TABLE_ACTIONS) { if (CellValueStr.Equals("U")) { Instruction = new CInstrUnforce(); logger.Debug(String.Format("Detected Unforce step.")); Instruction.data = VariableParser.parseAsVariable(Target, Location, Path, null); } else if (String.Compare(Target, "@POPUP@") == 0) { Instruction = new CInstrPopup(); logger.Debug(String.Format("Detected Popup.")); Instruction.data = CellValueStr; } else { Instruction = new CInstrForce(); logger.Debug(String.Format("Detected Force step.")); Instruction.data = VariableParser.parseAsVariable(Target, Location, Path, CellValueStr); } } else if (typeOfTable == TableTypes.TABLE_CHECKS) { if (String.Compare(Target, "@POPUP@") == 0) { Instruction = new CInstrPopup(); logger.Debug(String.Format("Detected Popup.")); Instruction.data = CellValueStr; } else { Instruction = new CInstrTest(); logger.Debug(String.Format("Detected Test step.")); Instruction.data = VariableParser.parseAsVariable(Target, Location, Path, CellValueStr); } } else { throw new NotImplementedException("This step is not recognized as a correct step"); } Instruction.ForceFailed = detectedChars.Contains('F'); Instruction.ForcePassed = detectedChars.Contains('P'); Instruction.Skipped = detectedChars.Contains('S'); return Instruction; }