Пример #1
0
        //TODO:again... what are you doing here ???
        private void AddTestPage(TestLoadInfo testLoadInfo, TabPage tabPage)
        {
            if (tabPage == null)
            {
                tabPage      = new TabPage();
                tabPage.Text = testLoadInfo.ClassName;
                tabPage.Name = testLoadInfo.ClassName;

                Label l = new Label();
                l.Text      = "Loading... \n" + testLoadInfo.ClassName;
                l.TextAlign = ContentAlignment.MiddleCenter;
                l.Dock      = System.Windows.Forms.DockStyle.Fill;

                tabPage.Controls.Add(l);

                this.GetTestWindowsTab().Controls.Add(tabPage);
                this.GetTestWindowsTab().SelectedTab = tabPage;
            }
            else if (testLoadInfo.Test != null)
            {
                //MyTabPage tabPage = new MyTabPage();
                tabPage.Text = testLoadInfo.Name;
                tabPage.Name = testLoadInfo.Name;

                TheTestWindow tw = new TheTestWindow(testLoadInfo);
                tw.Name = testLoadInfo.Name;
                tw.Dock = System.Windows.Forms.DockStyle.Fill;

                tabPage.Controls.Clear();
                tabPage.Controls.Add(tw);

                //this.GetTestWindowsTab().Controls.Add(tabPage);
                //this.GetTestWindowsTab().SelectedTab = tabPage;
            }
        }
Пример #2
0
        //TODO:this method
        public void UnLoadTest(TestLoadInfo holder)
        {
            //TODO: Unload should stop the test if its executing !!

            //TODO: null check and stuff
            TabControl tab = this.GetTestWindowsTab();

            Control[] pages = tab.Controls.Find(holder.Name, false);
            tab.Controls.Remove(pages[0]);

            holder.Test = null;
        }
Пример #3
0
        public void LoadTest(TestLoadInfo holder)
        {
            if (holder == null)
            {
                return;
            }

            //Tabpage was closed
            if (holder.Test != null)
            {
                TabPage tabPage1 = GetTestWindowsTab().TabPages[holder.Name];
                if (tabPage1 == null)
                {
                    holder.Test = null;
                }
                else
                {
                    this.GetTestWindowsTab().SelectedTab = tabPage1;
                    return;
                }
            }

            //TODO:what are you doing here ???
            TabPage tabPage = (TabPage)this.GetTestWindowsTab().Controls[holder.ClassName];

            AddTestPage(holder, tabPage);

            new Thread(new ThreadStart(delegate()
            {
                if (holder.Test == null)
                {
                    ITest test  = plugLoader.LoadPlug(holder.AppDomainName, holder.AssemblyName, holder.ClassName);
                    holder.Test = test;
                    //AddTestPage(test);
                    tabPage = (TabPage)this.GetTestWindowsTab().Controls[holder.ClassName];
                    InvokeOnControl(this, new MethodInvoker(delegate() { AddTestPage(holder, tabPage); }));
                }
                else
                {
                    //this.GetTestWindowsTab().SelectTab(holder.Test.Name);
                    InvokeOnControl(this, new MethodInvoker(delegate() { this.GetTestWindowsTab().SelectTab(holder.Name); }));
                }
            })).Start();
        }
Пример #4
0
        public void Start()
        {
            PlugLoader plugLoader = TempFactory.GetPlugLoader();

            plugLoader.AppDomainLoaded    += new AppDomainLoadedHandler(this.AppDomainLoaded);
            plugLoader.AppDomainUnloaded  += new AppDomainUnloadedHandler(this.AppDomainUnloaded);
            plugLoader.LoadingAppDomain   += new LoadingAppDomainHandler(this.LoadingAppDomain);
            plugLoader.LoadingPlug        += new LoadingPlugHandler(this.LoadingPlug);
            plugLoader.PlugLoaded         += new PlugLoadedHandler(this.PlugLoaded);
            plugLoader.PlugLoadException  += new PlugLoadExceptionHandler(this.PlugLoadException);
            plugLoader.UnloadingAppDomain += new UnloadingAppDomainHandler(this.UnloadingAppDomainHandler);


            TestLoadInfo[] testholders = plugLoader.GetAllPlugs(TempFactory.GetLoadTestsInfo());
            for (int i = 0; i < testholders.Length; i++)
            {
                Console.WriteLine(i + " : " + testholders[i]);
            }

            int inpi = 0;

            if (testholders.Length > 1)
            {
                Console.Write("Test#:");
                string inps = Console.ReadLine();
                inpi = Convert.ToInt32(inps);
            }

            TestLoadInfo tl = testholders[inpi];

            ITest         test = plugLoader.LoadPlug(tl.AppDomainName, tl.AssemblyName, tl.ClassName);
            ConsoleOutput cout = new ConsoleOutput();

            test.SetOutput(cout);
            cout.WriteLine("Parameters...");

            IParam[] tparams = test.GetParameters();

            INIReader r = new INIReader(AppDomain.CurrentDomain.BaseDirectory + "AllTests.ini");

            for (int y = 0; y < tparams.Length; y++)
            {
                IParam param = (tparams[y]);

                cout.WriteLine("Enter New Value for : " + param);
                if (param is NumberParam)
                {
                    if (testholders.Length == 1)
                    {
                        ((NumberParam)param).Number = Convert.ToInt32(r.ReadValue(testholders[inpi].AssemblyName, "Param" + y));
                    }
                    else
                    {
                        cout.Write("Number:");
                        ((NumberParam)param).Number = Convert.ToInt32(Get(param));
                    }
                }
                else if (param is TextParam)
                {
                    if (testholders.Length == 1)
                    {
                        ((TextParam)param).TextValue = r.ReadValue(testholders[inpi].AssemblyName, "Param" + y);
                    }
                    else
                    {
                        cout.Write("Text:");
                        ((TextParam)param).TextValue = Get(param);
                    }
                }
                else if (param is BoolParam)
                {
                    if (testholders.Length == 1)
                    {
                        ((BoolParam)param).Value = Convert.ToBoolean(r.ReadValue(testholders[inpi].AssemblyName, "Param" + y));
                    }
                    else
                    {
                        cout.Write("Bool:");
                        ((BoolParam)param).Value = Convert.ToBoolean(Get(param));
                    }
                }
                else if (param is KeyValueParam)
                {
                    cout.Write("KeyVal:");
                    //((KeyValueParam)param).SelectedText = ((ComboBox)control).SelectedValue.ToString();
                }
                else if (param is CoOrdinatesParam)
                {
                    if (testholders.Length == 1)
                    {
                        ((CoOrdinatesParam)param).XParam.Number = Convert.ToInt32(r.ReadValue(testholders[inpi].AssemblyName, "ParamX" + y));
                        ((CoOrdinatesParam)param).XParam.Number = Convert.ToInt32(r.ReadValue(testholders[inpi].AssemblyName, "ParamY" + y));
                    }
                    else
                    {
                        cout.Write("NumberX:");
                        ((CoOrdinatesParam)param).XParam.Number = Convert.ToInt32(Get(((CoOrdinatesParam)param).XParam));
                        cout.Write("NumberY:");
                        ((CoOrdinatesParam)param).YParam.Number = Convert.ToInt32(Get(((CoOrdinatesParam)param).YParam));
                    }
                }
            }


            cout.WriteLine("Enter to exec...");
            Console.ReadLine();

            test.ExecuteThis();
            cout.WriteLine("Done.");
            Console.ReadLine();
        }
Пример #5
0
 public TheTestWindow(TestLoadInfo testLoadInfo)
 {
     InitializeComponent();
     InitTestWindow(testLoadInfo.Test);
     InitHotKey();
 }
Пример #6
0
 public void AddTestHolder(TestLoadInfo test)
 {
     FilterListBox.AddListItem(test);
 }