Exemplo n.º 1
0
        private void checkTest()
        {
            if (TestsFileNames.Count > 0)
            {
                foreach (var testName in TestsFileNames){
                    System.IO.StreamReader fileReader = new System.IO.StreamReader(workingPath + "\\" + testName);
                    bool keepReading = true;

                    var TestReaded = new TestCase(new VBTestIdentifier());
                    while (keepReading)
                    {
                        var lineReaded = fileReader.ReadLine();
                        if (lineReaded.Contains("'@FILE_NAME"))
                        {
                            TestReaded.TestFileName = lineReaded.Replace("'@FILE_NAME", " ").Trim();
                        }
                        if (lineReaded.Contains("'@TEST_NAME"))
                        {
                            TestReaded.TestName= lineReaded.Replace("'@TEST_NAME", " ").Trim();
                        }
                        if (lineReaded.Contains("'@TEST_DOMAINE"))
                        {
                            TestReaded.TestDomain = lineReaded.Replace("'@TEST_DOMAINE", " ").Trim();
                        }
                        if (lineReaded.Contains("'@TEST_BEHAVIOR"))
                        {
                            if (TestReaded.TestBehaviour != null && TestReaded.TestBehaviour.Count() > 0)
                            {
                                TestReaded.TestBehaviour += " ";
                            }
                            TestReaded.TestBehaviour += lineReaded.Replace("'@TEST_BEHAVIOR", " ").Trim();
                        }
                        if (lineReaded.Contains("'@DESCRIPTION"))
                        {
                            if (TestReaded.TestDescription != null && TestReaded.TestDescription.Count() > 0)
                            {
                                TestReaded.TestDescription += " ";
                            }
                            TestReaded.TestDescription+= lineReaded.Replace("'@DESCRIPTION", " ").Trim();
                        }
                        TestReaded.TestPhysicalFileName = testName;
                        var endsQC = lineReaded.Contains("@EndQC");
                        keepReading = !(!fileReader.EndOfStream && endsQC);
                    }
                    //Console.WriteLine("File Name = " + TestReaded.TestFileName);
                    //Console.WriteLine("Test Domain= " + TestReaded.TestDomain);
                    //Console.WriteLine("Test Behaviour= " + TestReaded.TestBehaviour);
                    //Console.WriteLine("Test Description= " + TestReaded.TestDescription);
                    TestCases.Add(TestReaded);
                }
            }
        }
Exemplo n.º 2
0
 private void populateVB(TestCase TS)
 {
     VBFileNameText.Text = TS.TestFileName;
     VBDescriptionText.Text = TS.TestDescription;
     VBDomainText.Text = TS.TestDomain;
     VBBehaviorText.Text = TS.TestBehaviour;
 }
Exemplo n.º 3
0
 private void populateExcel(TestCase TS)
 {
     ExcelFileNameText.Text = TS.TestName;
     ExcelDescriptionText.Text = TS.TestBehaviour;
     ExcelDomainText.Text = TS.TestDomain;
 }
Exemplo n.º 4
0
        public void Parse()
        {
            XSSFSheet sheet = (XSSFSheet)template.GetSheet("VTR System");

            //header processing
            XSSFRow dataRow = (XSSFRow)sheet.GetRow(0);

            var dm = dataRow.GetEnumerator();

            int counter = 0;
            while (dm.MoveNext())
            {
                string cellVal = ((XSSFCell)dm.Current).StringCellValue;
                if (cellVal.ToLower().Trim() == "system test name")
                {
                    SystemTestRowName = counter;
                    Console.WriteLine(cellVal);
                }
                if (cellVal.ToLower().Trim() == "test objective")
                {
                    SystemTestRowObjective = counter;
                    Console.WriteLine(cellVal);
                }
                if (cellVal.ToLower().Trim() == "requirement domain")
                {
                    SystemTestRowDomain = counter;
                }
                counter++;
            }

            // body processing
            bool FoundEmptyTestName = true;
            int emptyCounter = 0;
            counter = 1;
            while (FoundEmptyTestName)
            {
                dataRow = (XSSFRow)sheet.GetRow(counter);
                string TestName = dataRow.GetCell(SystemTestRowName).StringCellValue;
                string TestObjective = dataRow.GetCell(SystemTestRowObjective).StringCellValue;
                string TestDomain = dataRow.GetCell(SystemTestRowDomain).StringCellValue;
                if (TestName.Trim().Count() > 0) {
                    TestCase CurrentTestCase = new TestCase(new ExcelTestIdentifier());
                    CurrentTestCase.TestName = TestName;
                    CurrentTestCase.TestDomain = TestDomain;
                    CurrentTestCase.TestBehaviour = TestObjective;
                    TestCases.Add(CurrentTestCase);
                }
                if (TestName.Count() == 0)
                {
                    emptyCounter++;
                }
                else
                {
                    emptyCounter = 0;
                }

                FoundEmptyTestName = !(emptyCounter > 2);
                counter++;

            }
            //sort the testcases based on name
            TestCases.Sort(new TestNameComparer());
        }