Esempio n. 1
0
 private void TestCases_SelectedIndexChanged(object sender, EventArgs e)
 {
     LogPath.Text         = Directory.GetCurrentDirectory() + @"\testCase\" + TestCases.Text + @"\test-result\log\RunLog.log";
     StartTest.Enabled    = true;
     CancelTest.Enabled   = false;
     editTestCase.Enabled = true;
     report.Enabled       = true;
     num.Enabled          = true;
     //初始化统计数据
     PassLabel.Text        = "0";
     FailLabel.Text        = "0";
     ProgressLabel.Text    = "0%";
     SuccessRatelabel.Text = "0%";
     CaseCount             = ExcelUtils.GetRunCaseNum(TestCases.Text);
     RunCaseCount.Text     = CaseCount.ToString();
     RunCount  = 0;
     PassCount = 0;
     FailCount = 0;
     this.AndroidTest.Enabled = true;
     this.WebTest.Enabled     = true;
     this.num.Maximum         = CaseCount;
 }
Esempio n. 2
0
        private void StartTest_Click(object sender, EventArgs e)
        {
            //初始化统计数据
            PassLabel.Text        = "0";
            FailLabel.Text        = "0";
            ProgressLabel.Text    = "0%";
            SuccessRatelabel.Text = "0%";
            CaseCount             = ExcelUtils.GetRunCaseNum(TestCases.Text);
            RunCaseCount.Text     = CaseCount.ToString();
            RunCount  = 0;
            PassCount = 0;
            FailCount = 0;
            this.StartTest.Enabled  = false;
            this.CancelTest.Enabled = true;
            StringBuilder sb = new StringBuilder();

            if (WebTest.Checked == true)
            {
                if (SelectBrowser2.Text != "")
                {
                    sb.Append("-testcase ");
                    sb.Append(TestCases.Text);
                    sb.Append(" -type web ");
                    sb.Append("-browser ");
                    sb.Append(SelectBrowser2.Text);
                    sb.Append(" -thread ");
                    sb.Append(num.Text);
                    RealAction("./StartAwTest.exe", sb.ToString());
                }
                else
                {
                    MessageBoxEx.Show(this, "请完整填写测试配置", "Error !");
                    this.StartTest.Enabled  = true;
                    this.CancelTest.Enabled = false;
                }
            }
            else if (AndroidTest.Checked == true)
            {
                if (devicesName.Text == "" || AppName2.Text == "" || pagename2.Text == "" || activity2.Text == "")
                {
                    MessageBoxEx.Show(this, "请完整填写测试配置", "Error !");
                    this.StartTest.Enabled  = true;
                    this.CancelTest.Enabled = false;
                }
                else
                {
                    sb.Append("-testcase ");
                    sb.Append(TestCases.Text);
                    sb.Append(" -type ");
                    sb.Append(androidType2.Text);
                    sb.Append(" -os Android");
                    sb.Append(" -device ");
                    sb.Append(devicesName.Text);
                    sb.Append(" -thread ");
                    sb.Append(num.Text);
                    sb.Append(" -appname ");
                    sb.Append(AppName2.Text);
                    sb.Append(" -packagename ");
                    sb.Append(pagename2.Text);
                    sb.Append(" -activity ");
                    sb.Append(activity2.Text);
                    if (reset.Checked)
                    {
                        sb.Append(" -norest true");
                    }
                    if (DebugMode.Checked)
                    {
                        sb.Append(" -debug true");
                    }
                    RealAction("./StartAwTest.exe", sb.ToString());
                }
            }
            else
            {
                MessageBoxEx.Show(this, "请完整填写测试配置", "Error !");


                //MessageBoxEx.Show("请完整填写测试配置", "Error !");
                this.StartTest.Enabled  = true;
                this.CancelTest.Enabled = false;
            }
        }