예제 #1
0
 private TestStandGen(CTestContainer sequence, string outFile, string templatePath)
 {
     this.sequence = sequence;
     this.outFile = outFile;
     this.templatePath = templatePath;
     initialize();
 }
예제 #2
0
        public void GenerateAllSteps()
        {
            CTsInstrFactory.loadConfiguration("C:\\macros_alstom\\Configuration\\LocationConfiguration.xml");
                CTestContainer container = new CTestContainer();

                CTest test = new CTest("Test_1", "This is my description");

                CStep step = new CStep("Step 1", null, null);
        }
예제 #3
0
        public static void genSequence(CTestContainer sequence, string outFile, string templatePath)
        {
            string URIFilename = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase) + Path.DirectorySeparatorChar + "Configuration" + Path.DirectorySeparatorChar + "LocationConfiguration.xml";
            Uri uri = new Uri(URIFilename);
            logger.Debug("Defining Configuration file to " + uri.LocalPath);
            CTsInstrFactory.loadConfiguration(uri.LocalPath);

            TestStandGen test = new TestStandGen(sequence, outFile, templatePath);

            test.writeScenario();
        }
예제 #4
0
        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);
        }
예제 #5
0
        public static CTestContainer parseTestsOfWorkbook(Excel.Sheets sheets, string filename)
        {
            logger.Info("Begin Analysis of selected sheets");

            CTestContainer listOfTests = new CTestContainer();
            WorkbookReport report = new WorkbookReport(filename);

            foreach (Excel.Worksheet wsCurrentTestSheet in sheets)
            {
                logger.Debug(String.Format("Processing sheet \"{0}\".", wsCurrentTestSheet.Name));
                SheetReport sheetReport = new SheetReport(wsCurrentTestSheet.Name);

                try
                {
                    ExcelTestStruct tableRefs = findTablesInSheet(wsCurrentTestSheet, sheetReport);
                    CTest result = TestSheetParser.parseTest(wsCurrentTestSheet.Name, wsCurrentTestSheet, tableRefs, sheetReport);

                    logger.Debug("Adding sheet to result list");

                    listOfTests.Add(result);

                }
                catch (Exception ex)
                {
                    logger.Fatal("Sheet cannot be parsed : ", ex);
                    sheetReport.add(new MessageReport("Parsing error", "Sheet", "Sheet was not analysed. Message is : "+ ex.Message, Criticity.Critical));
                }
                report.add(sheetReport);
            }

            string URIFilename = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase) + Path.DirectorySeparatorChar + "Report.html";
            Uri uri = new Uri(URIFilename);
            logger.Debug("Writing report in "+URIFilename);

            report.printReport(uri.LocalPath);

            if (report.NbrMessages > 0)
            {
                System.Diagnostics.Process.Start(URIFilename);
            }

            return listOfTests;
        }
예제 #6
0
        /// <summary>
        /// Converts a potentially complex tree structure to a standardized, linear TestStand sequence list
        /// </summary>
        /// <param name="sequence">Sequence to convert</param
        /// <returns>Sequence, in a format understandable to generate</returns>
        private TestStandFile genTsStructFromTestContainer(string filename, CTestContainer sequence)
        {
            TestStandFile ts = new TestStandFile(filename);

            foreach(CTest test in sequence)
            {
                logger.Info("Processing sequence");
                CTestStandSeq SubSeq = genInstrListFromTest(test);

                ts.addSequence("Call to subsequence " + SubSeq.identifier, SubSeq);
                logger.Debug("End of sequence Processing");
            }
            return ts;
        }