Ejemplo n.º 1
0
 private void addTest(ItestCase test)
 {
     IJob job = new GUnitFramework.Implementation.Job();
     job.Command = m_runner.GTestExecutable;
     job.Argument = " --gtest_filter=" + test.Name;
     job.StdErrCallBack = StdErrCallBack;
     job.StdOutCallBack = StdOutCallBack;
     m_runner.Processhandler.JobList.Add(job);
 }
Ejemplo n.º 2
0
        private void RunInit(string rPath)
        {
            //创建结果目录
            if (!Directory.Exists(rPath))
            {
                Directory.CreateDirectory(rPath);
            }
            else
            {
                DirectoryInfo dirInfo = new DirectoryInfo(rPath);
                FileInfo[]    files   = dirInfo.GetFiles();
                //logHelper.info("file.Delete size:" + files.Count());
                //删除不了会报错
                foreach (FileInfo file in files)
                {
                    //logHelper.info("file.Delete:" + file.FullName);
                    try { file.Delete(); }
                    catch (Exception e)
                    {
                        logHelper.error(e);
                    }
                }
            }


            if (caseHelper is appiumHelper.appiumTestCase)//如果是appium 初始化
            {
                caseHelper.caseXml = this.caseXml;
                (caseHelper as appiumHelper.appiumTestCase).init();
            }
            else
            {
                if (caseHelper != null)
                {
                    caseHelper.CloseAll();
                }

                XElement step = caseXml.Descendants("Step").FirstOrDefault();

                string name = "R_initStep";//随便赋值的
                if (step != null)
                {
                    name = step.Attribute("name").Value;
                }


                if (name.Contains("R_"))//robotium 初始化
                {
                    //logHelper.info("init.robotium: start");

                    var help = new robotiumHelper.robotiumTestCase();


                    help.device  = this.device;
                    help.caseXml = this.caseXml;
                    help.init();

                    //runApk 相同
                    if (caseHelper is robotiumHelper.robotiumTestCase && ((robotiumHelper.robotiumTestCase)caseHelper).RunApk == help.RunApk)
                    {
                        help.install = false;
                    }
                    else
                    {
                        help.install = true;
                    }
                    caseHelper = help;
                }
                else if (name.Contains("UI_"))//uiautomator 初始化
                {
                    var help = new UiautomatorHelper.UiautomatorTestCase();
                    caseHelper = help;

                    help.device  = this.device;
                    help.caseXml = this.caseXml;
                }
                else //chrome 初始化
                {
                    var help = new chromeHelper.chromeTestCase(device, port);
                    caseHelper = help;

                    help.caseXml = this.caseXml;
                }
            }
        }
Ejemplo n.º 3
0
 public webTestClient()
 {
     this.port = testHelper.FindFreePort();
     webHelper = new chromeWebCase(this.port);
 }
Ejemplo n.º 4
0
        private bool IsTestSpecification(string line, ItestCase test)
        {
            string[] splitArray = {"@#"};
            string[] result;
            bool retval = false;
            if (line.Contains("@#TESTPHASENAME@#"))
            {
               result= line.Split(splitArray, StringSplitOptions.RemoveEmptyEntries);
               if (result.Length == 2)
               {
                   test.TestPhaseNumber = result[1];
               }
               else
               {
                   test.TestPhaseNumber = "Unknown";
               }
               retval = true;
            }
            else if (line.Contains("@#DESCRIPTION@#"))
            {
                result = line.Split(splitArray, StringSplitOptions.RemoveEmptyEntries);
                if (result.Length == 2)
                {
                    test.TestDescription = ( result[1]);
                }
                else
                {
                    test.TestDescription = "";
                }
                retval = true;

            }
            else if (line.Contains("@#EXPECTATION@#"))
            {
                result = line.Split(splitArray, StringSplitOptions.RemoveEmptyEntries);
                if (result.Length == 2)
                {
                    test.ExpectedResult.Add(result[1]);
                }
                retval = true;

            }
            else if (line.Contains("@#PRECONDITION@#"))
            {
                result = line.Split(splitArray, StringSplitOptions.RemoveEmptyEntries);
                if (result.Length == 2)
                {
                    test.TestPrecondition.Add(result[1]);
                }

                retval = true;
            }
            else if (line.Contains("@#TESTSTEP@#"))
            {
                result = line.Split(splitArray, StringSplitOptions.RemoveEmptyEntries);
                if (result.Length == 2)
                {
                    test.TestSteps.Add(result[1]);
                }
                retval = true;
            }

            return retval;
        }
Ejemplo n.º 5
0
 public void addSelectedTests(ItestCase test)
 {
     SelectedTests.Add(test);
     FirePropertyChange("SELECTED_TEST");
 }