예제 #1
0
        private void cmdTest_Click(object sender, EventArgs e)
        {
            ListViewItem item = GetSelectItem();

            if (item != null)
            {
                mLastTest = item.Text;
                mSuccess  = 0;
                mErrors   = 0;
                chart1.Series["Success"].Points.Clear();

                chart1.Series["Error"].Points.Clear();

                foreach (NodeInfo node in Nodes)
                {
                    node.Report.Reset();
                }

                Codes.CaseSetting setting = new Codes.CaseSetting();
                setting.Users = int.Parse(txtUsers.Text);
                if (propertyGrid1.SelectedObject != null)
                {
                    setting.Config = Newtonsoft.Json.JsonConvert.SerializeObject(propertyGrid1.SelectedObject);
                }
                Codes.ManagerSetting.SaveCaseSetting(this.UnitTest, item.Text, setting);
                Client.RunTest(this.UnitTest, item.Text, int.Parse(txtUsers.Text), propertyGrid1.SelectedObject,
                               Nodes.Select(d => d.Name).ToArray());
            }
            else
            {
                MessageBox.Show(this, "Please select a test case!");
            }
        }
예제 #2
0
        public static void SaveCaseSetting(string unittest, string testcase, CaseSetting e)
        {
            string file = string.Format("{0}_{1}.json", unittest, testcase);

            using (System.IO.StreamWriter writer = new System.IO.StreamWriter(file, false, Encoding.UTF8))
            {
                writer.Write(Newtonsoft.Json.JsonConvert.SerializeObject(e));
            }
        }
예제 #3
0
        public void GetTestConfigCode(GetTestConfigCodeResponse e)
        {
            if (!string.IsNullOrEmpty(e.Code))
            {
                DTCore.Domains.FileCompiler Compiler = new DTCore.Domains.FileCompiler();
                System.Reflection.Assembly  assembly = Compiler.CreateAsssemblyFromCodes(true, e.Code);
                Type type = assembly.GetType(e.ClassName);

                ListViewItem      item    = GetSelectItem();
                Codes.CaseSetting setting = Codes.ManagerSetting.GetCaseSetting(this.UnitTest, item.Text);
                txtUsers.Text = setting.Users.ToString();
                if (!string.IsNullOrEmpty(setting.Config))
                {
                    propertyGrid1.SelectedObject = Newtonsoft.Json.JsonConvert.DeserializeObject(setting.Config, type);
                }
                else
                {
                    propertyGrid1.SelectedObject = Activator.CreateInstance(type);
                }
            }
        }