Exemplo n.º 1
0
        /// <summary>
        /// Creates a beep instruction.
        /// </summary>
        /// <param name="xn">The XML repersentation of the instruction to be created</param>
        /// <param name="con">The current context object</param>
        static Beep CreateBeep(XmlNode xn, Context con)
        {
            Beep beep = CreateBeep(xn);

            AddInstruction(xn, beep, con);
            return(beep);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a beep instruction.
        /// </summary>
        /// <param name="xn">The XML repersentation of the instruction to be created</param>
        /// <returns>A Beep intsruction</returns>
        static Beep CreateBeep(XmlNode xn)
        {
            Beep   beep = new Beep();
            string rest = XmlFiler.getAttribute(xn, "wait");

            if (rest != null)
            {
                beep.Rest = Convert.ToInt32(rest);
            }
            return(beep);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets the name of a test script and runs it.
        /// There must be a corresponding XML script file in the
        /// location specified in the GtdConfig.xml file.
        /// </summary>
        /// <param name="script">The name of the test script (.xml not needed).</param>
        public void fromFile(string script)
        {
            if (!(script.ToLower()).EndsWith(@".xml"))
            {
                script += ".xml";
            }
            TestState ts = null;

            if (varsDefined)             // true only if AddVariable() was called.
            {
                ts = TestState.getOnly();
                // Re-open the log using the script name - lose what's there.
                Logger.getOnly().close(Logger.Disposition.Hung);
                // The next call to Logger.getOnly() will create one with using the script name.
            }
            else
            {
                ts = TestState.getOnly(m_appSymbol); // Allocating ts here insures deallocation
            }
            ts.Script = script;                      // must come before ts.PublishVars();
            ts.PublishVars();

            // get the script path from the configuration file
            string     path       = ts.getScriptPath() + @"\" + script;
            XmlElement scriptRoot = XmlFiler.getDocumentElement(path, "accil", false);

            Assert.IsNotNull(scriptRoot, "Missing document element 'accil'.");
            Instructionator.initialize("AxilInstructions.xml");
            OnDesktop dt = new OnDesktop();

            Assert.IsNotNull(dt, "OnDesktop not created for script " + path);
            dt.Element = scriptRoot;             // not quite code-behind, but OK
            dt.Number  = ts.IncInstructionCount;
            //dt = new XmlInstructionBuilder().Parse(path);

            // now execute any variables if they've been added before executing the desktop
            foreach (Var v in m_vars)
            {
                v.Execute();
            }

            System.GC.Collect();             // forces collection on NUnit process only

            Beep beeep = new Beep();

            beeep.Execute();             // play a beep tone so we know when the test starts

            dt.Execute();
            varsDefined = false;             // the next test may not have any
            Logger.getOnly().close(Logger.Disposition.Pass);

            Thread.Sleep(1000);
        }
Exemplo n.º 4
0
		/// <summary>
		/// Creates a beep instruction.
		/// </summary>
		/// <param name="xn">The XML repersentation of the instruction to be created</param>
		/// <returns>A Beep intsruction</returns>
		static Beep CreateBeep(XmlNode xn)
		{
			Beep beep = new Beep();
			string rest = XmlFiler.getAttribute(xn, "wait");
			if (rest != null) beep.Rest = Convert.ToInt32(rest);
			return beep;
		}
Exemplo n.º 5
0
        /// <summary>
        /// Gets the name of a test script and runs it.
        /// There must be a corresponding XML script file in the
        /// location specified in the GtdConfig.xml file.
        /// </summary>
        /// <param name="script">The name of the test script (.xml not needed).</param>
        public void fromFile(string script)
        {
            if(!(script.ToLower()).EndsWith(@".xml"))
                script += ".xml";
            TestState ts = null;
            if (varsDefined) // true only if AddVariable() was called.
            {
                ts = TestState.getOnly();
                // Re-open the log using the script name - lose what's there.
                Logger.getOnly().close(Logger.Disposition.Hung);
                // The next call to Logger.getOnly() will create one with using the script name.
            }
            else ts = TestState.getOnly(m_appSymbol); // Allocating ts here insures deallocation
            ts.Script = script; // must come before ts.PublishVars();
            ts.PublishVars();

            // get the script path from the configuration file
            string path = ts.getScriptPath() + @"\" + script;
            XmlElement scriptRoot = XmlFiler.getDocumentElement(path, "accil", false);
            Assert.IsNotNull(scriptRoot, "Missing document element 'accil'.");
            Instructionator.initialize("AxilInstructions.xml");
            OnDesktop dt = new OnDesktop();
            Assert.IsNotNull(dt, "OnDesktop not created for script " + path);
            dt.Element = scriptRoot; // not quite code-behind, but OK
            dt.Number = ts.IncInstructionCount;
            //dt = new XmlInstructionBuilder().Parse(path);

            // now execute any variables if they've been added before executing the desktop
            foreach (Var v in m_vars)
            {
                v.Execute();
            }

            System.GC.Collect(); // forces collection on NUnit process only

            Beep beeep = new Beep();
            beeep.Execute(); // play a beep tone so we know when the test starts

            dt.Execute();
            varsDefined = false; // the next test may not have any
            Logger.getOnly().close(Logger.Disposition.Pass);

            Thread.Sleep(1000);
        }