示例#1
0
        /// <summary>
        /// ITestStep.Execute() implementation
        /// </summary>
        /// <param name='testConfig'>The Xml fragment containing the configuration for this test step</param>
        /// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
        public void Execute(XmlNode testConfig, Context context)
        {
            _ctx = context;
            string loadGenTestConfig = context.ReadConfigAsString(testConfig, "LoadGenTestConfig");

            try
            {
                context.LogInfo("About to execute LoadGen script: {0}", loadGenTestConfig);

                var doc = new XmlDocument();
                doc.Load(loadGenTestConfig);

                if (string.Compare(doc.FirstChild.Name, "LoadGenFramework", true, new CultureInfo("en-US")) != 0)
                {
                    throw new ConfigException("LoadGen Configuration File Schema Invalid!");
                }

                var loadGen = new LoadGen(doc.FirstChild);
                loadGen.LoadGenStopped += LoadGenStopped;
                loadGen.Start();
            }
            catch (ConfigException cex)
            {
                context.LogError(cex.Message);
                throw;
            }
            catch (Exception ex)
            {
                context.LogError(ex.Message);
                throw;
            }

            while (!_bExitApp)
            {
                Thread.Sleep(0x3e8);
            }
            Thread.Sleep(0x1388);
        }
示例#2
0
		/// <summary>
		/// ITestStep.Execute() implementation
		/// </summary>
		/// <param name='testConfig'>The Xml fragment containing the configuration for this test step</param>
		/// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
		public void Execute(XmlNode testConfig, Context context)
		{
            _ctx = context;
            string loadGenTestConfig = context.ReadConfigAsString(testConfig, "LoadGenTestConfig");

            try
            {
                context.LogInfo("About to execute LoadGen script: {0}", loadGenTestConfig);

                var doc = new XmlDocument();
                doc.Load(loadGenTestConfig);

                if (string.Compare(doc.FirstChild.Name, "LoadGenFramework", true, new CultureInfo("en-US")) != 0)
                {
                    throw new ConfigException("LoadGen Configuration File Schema Invalid!");
                }

                var loadGen = new LoadGen(doc.FirstChild);
                loadGen.LoadGenStopped += LoadGenStopped;
                loadGen.Start();
            }
            catch (ConfigException cex)
            {
                context.LogError(cex.Message);
                throw;
            }
            catch (Exception ex)
            {
                context.LogError(ex.Message);
                throw;
            }

            while (!_bExitApp)
            {
                Thread.Sleep(0x3e8);
            }
            Thread.Sleep(0x1388);
        }