Esempio n. 1
0
        public static DataTable ReadCsv(QATestStuff testStuff, string fileName)
        {
            DataTable    dataTable    = new DataTable();
            StreamReader streamReader = new StreamReader(fileName);
            int          lineReads    = 0;

            string[] columns = streamReader.ReadLine().Split(',');
            lineReads++;
            foreach (string s in columns)
            {
                dataTable.Columns.Add(s);
            }
            if (dataTable.Columns.Count != 4)
            {
                return(null);
            }
            while (!streamReader.EndOfStream)
            {
                string line = streamReader.ReadLine();


                if (line[0] == '[' && line[line.Length - 1] == ']') //komentatrz //niby przeniesione do test plan from data table, ale konieczne tutaj, żeby sie nie wywaliło
                {
                    continue;
                }


                string[] cells
                    = Regex.Split(line, ",(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)");
                if (cells.Count() > 4)
                {
                    //return null; //źródło błędów, xpath z plugina może zawierać przecinki

                    for (int i = 4; i < cells.Count(); i++)
                    {
                        cells[3] += cells[i];
                    }

                    cells = cells.Where((value, index) => index < 4).ToArray();
                }
                lineReads++;
                DataRow row = dataTable.NewRow();
                for (int i = 0; i < cells.Length; i++)
                {
                    row[i] = cells[i];
                }
                if ((lineReads >= testStuff.minRow) && (lineReads <= testStuff.maxRow))
                {
                    dataTable.Rows.Add(row);
                }
            }
            streamReader.Close();
            return(dataTable);
        }
Esempio n. 2
0
        public static DataTable ReadExcellSheet(QATestStuff testStuff, string fileName)
        {
            try
            {
                DataTable dataSheet = new DataTable();
                //OleDbConnection connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + "; Jet OLEDB:Engine Type=5;Extended Properties=\"Excel 8.0;HDR=NO\"");
                OleDbConnection connection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=\"Excel 12.0;HDR=NO\"");

                connection.Open();

                DataTable schema    = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
                string    sheetName = schema.Rows[0].Field <string>("TABLE_NAME");

                string select = "select * from [" + sheetName + "A" + testStuff.minRow.ToString() + ":D" + testStuff.maxRow.ToString() + "]";



                OleDbDataAdapter sheetAdapter = new OleDbDataAdapter(select, connection);
                sheetAdapter.Fill(dataSheet);

                connection.Close();

                //usunięcie komentarzy
                //przeniesione do test plan from data table

                /*
                 * dataSheet.AcceptChanges();
                 * foreach (DataRow row in dataSheet.Rows)
                 * {
                 *  string s = row[0].ToString();
                 *  if (s[0] == '[' && s[s.Length - 1] == ']')
                 *  {
                 *      row.Delete();
                 *  }
                 * }
                 * dataSheet.AcceptChanges();
                 */

                return(dataSheet);
            }
            catch (Exception e)
            {
                MessageBox.Show("Can't read this file. Try using *.csv file. Exception:\r\n" + e.ToString());
                return(null);
            }
        }
Esempio n. 3
0
        //private Structs.TestPlan testPlan;


        public QATestLauncher(IQATestLaunchPoint launchPoint1)
        {
            launchPoint         = launchPoint1; //np. Form1
            testStuff           = launchPoint1.GetTestStuff();
            testPlanAsDataTable = launchPoint1.GetTestPlanAsDataTable();

            if (TestPlanFromDataTable.IsValid(testPlanAsDataTable))
            {
                testStuff.testPlan        = TestPlanFromDataTable.GetTestPlan(testPlanAsDataTable);
                qATest                    = new QATest(testStuff);
                qATest.RunFinishedEvent  += OnRunFinished;
                qATest.StepFinishedEvent += OnStepFinished;
            }
            else
            {
                testStuff.Log("This source doesn't contain a valid test plan or read failed. Test cancelled.");
            }
        }
Esempio n. 4
0
        private void StartTest()
        {
            //test czy występuje problem sesji 0
            //System.Diagnostics.Process.Start(@"C:\Windows\System32\notepad.exe");
            //return;



            testRunning = true;

            currentTestStart = DateTime.Now;

            QATestStuff.QATestStuffOptions stuffOptions = new QATestStuff.QATestStuffOptions();
            stuffOptions.killDriver      = true; //default true!!
            stuffOptions.minRow          = 2;
            stuffOptions.maxRow          = 1000000;
            currentTestStuff             = new QATestStuff(stuffOptions);
            currentTestStuff.testManager = this; //tylko klasa test manager to robi, form1 zostawia null
            currentTestStuff.CreateDriver();     //a może testStuff.driver = ..?
            currentTestStuff.Init();
            new QATestLauncher(this).Run();
        }
Esempio n. 5
0
        private void StartTest()
        {
            DialogResult dialogResult =
                MessageBox.Show(Settings.message1,
                                "Cześć!", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (dialogResult != DialogResult.OK)
            {
                return;
            }



            QATestStuff.QATestStuffOptions stuffOptions = new QATestStuff.QATestStuffOptions();
            stuffOptions.killDriver = checkBox1.Checked;
            stuffOptions.minRow     = (int)numericUpDown1.Value;
            stuffOptions.maxRow     = (int)numericUpDown2.Value;
            testStuff = new QATestStuff(stuffOptions);
            testStuff.CreateDriver(); //inna klasa można chcieć zrobić testStuff.driver = ...
            testStuff.Init();
            new QATestLauncher(this).Run();

            button2.Enabled = true;
        }
Esempio n. 6
0
 public OpActions(QATestStuff testStuff1)
 {
     testStuff = testStuff1;
 }
Esempio n. 7
0
 public Operations(QATestStuff testStuff1)
 {
     testStuff = testStuff1; //wskaźnik, bez kopiowania blurp hrpfr
     opActions = new OpActions(testStuff1);
 }
Esempio n. 8
0
 public QATest(QATestStuff testStuff1)
 {
     testPlan  = testStuff1.testPlan;
     testStuff = testStuff1;
 }