コード例 #1
0
        private void getTestResult()
        {
            if (debug)
            {
                Console.WriteLine("TestRobot.getTestResult() called");
            }

            com.csiro.xml.datatype.Item item = DataUtility.getTheFirstItem(DataUtility.getTheFirstCatelog(cmd));
            string srcPath = DataUtility.getPropertyValueByName(item, "srcPath");
            string disPath = DataUtility.getPropertyValueByName(item, "disPath");

            Process myProcess = new Process();

            myProcess.StartInfo.FileName       = "xcopy";
            myProcess.StartInfo.Arguments      = "/Q /C /E " + srcPath + " " + disPath;
            myProcess.StartInfo.CreateNoWindow = false;

            if (debug)
            {
                Console.Write("To do: " + myProcess.StartInfo.ToString());
            }
            myProcess.Start();
            if (debug)
            {
                Console.WriteLine("......OK");
            }
        }
コード例 #2
0
        private void startTest()
        {
            if (debug)
            {
                Console.WriteLine("TestRobot.startTest() called");
            }

            com.csiro.xml.datatype.Item item = DataUtility.getTheFirstItem(DataUtility.getTheFirstCatelog(cmd));

            string workDir            = DataUtility.getPropertyValueByName(item, "workDir");
            string testFileName       = DataUtility.getPropertyValueByName(item, "testFileName");
            string testConfigFileName = DataUtility.getPropertyValueByName(item, "testConfigFileName");

            if (debug)
            {
                Console.WriteLine("workDir = " + workDir);
                Console.WriteLine("testFileName " + testFileName);
                Console.WriteLine("testConfigFileName = " + testConfigFileName);
            }

            Process myProcess = new Process();

            myProcess.StartInfo.WorkingDirectory = workDir;
            myProcess.StartInfo.FileName         = testFileName;
            myProcess.StartInfo.Arguments        = "-f " + testConfigFileName + " -t " + cmd.name;
            myProcess.StartInfo.CreateNoWindow   = true;

            if (debug)
            {
                Console.Write("To start: " + myProcess.StartInfo.FileName + " " + myProcess.StartInfo.Arguments);
            }
            myProcess.Start();
            if (debug)
            {
                Console.WriteLine("......OK");
            }
        }
コード例 #3
0
ファイル: Tester.cs プロジェクト: shipingchen/iTester
        public Tester(string[] args)
        {
            // process args
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].Equals("-f"))
                {
                    this.fileName = args[++i];
                }
                if (args[i].Equals("-t"))
                {
                    this.testName = args[++i];
                }
            }

            if (debug)
            {
                Console.WriteLine("fileName = " + this.fileName);
            }

            // load config file -> obj
            try
            {
                if (debug)
                {
                    Console.WriteLine("To open file: " + this.fileName);
                }
                XmlTextReader xmlReader = new XmlTextReader(this.fileName);
                XmlSerializer xmlSer    = new XmlSerializer(typeof(Config));

                config = (Config)xmlSer.Deserialize(xmlReader);
                xmlReader.Close();

                if (debug)
                {
                    DataUtility.print(config);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed to open the file, due to " + e.ToString());
                Environment.Exit(1);
            }

            if (debug)
            {
                DataUtility.print(config);
            }

            // get testing data from config
            com.csiro.xml.datatype.Item item = DataUtility.getTheFirstItem(DataUtility.getTheFirstCatelog(config));

            this.numClients   = Int32.Parse(DataUtility.getPropertyValueByName(item, "numClients", "10"));
            this.testTime     = (ulong)(Int32.Parse(DataUtility.getPropertyValueByName(item, "testTime", "30")) * 1000);
            this.warmupRate   = Double.Parse(DataUtility.getPropertyValueByName(item, "warmupRate", "0.1"));
            this.cooldownRate = Double.Parse(DataUtility.getPropertyValueByName(item, "cooldownRate", "0.1"));
            this.isPreRun     = Boolean.Parse(DataUtility.getPropertyValueByName(item, "isPreRun", "true"));
            this.isPostRun    = Boolean.Parse(DataUtility.getPropertyValueByName(item, "PostRun", "false"));

            this.testAssemblyName     = DataUtility.getPropertyValueByName(item, "testAssemblyName", "MyTest");
            this.testAssemblyTypeName = DataUtility.getPropertyValueByName(item, "testAssemblyTypeName", "Interfaces.ITestRun");

            this.machineName = System.Environment.MachineName;
            this.logPath     = DataUtility.getPropertyValueByName(item, "logDirName", ".\\log");

            if (debug)
            {
                Console.WriteLine("machineName          = " + machineName);
                Console.WriteLine("testName             = " + testName);
                Console.WriteLine("numClients           = " + numClients);
                Console.WriteLine("testTime             = " + testTime);
                Console.WriteLine("warmupRate           = " + warmupRate);
                Console.WriteLine("cooldownRate         = " + cooldownRate);
                Console.WriteLine("testAssemblyName     = " + testAssemblyName);
                Console.WriteLine("testAssemblyTypeName = " + testAssemblyTypeName);
                Console.WriteLine("logPath              = " + logPath);
                Console.WriteLine("isPreRun             = " + isPreRun);
                Console.WriteLine("isPostRun            = " + isPostRun);

                Console.WriteLine("");
                Console.WriteLine("");
            }
        }