Ejemplo n.º 1
0
        public override StringBuilder Convert(string fullFileName = "")
        {
            //_HACK safe to delete
            #region ---TEST ONLY: Compiler will  automatically erase this in RELEASE mode and it will not run if Global.GlobalTestMode is not set to TestMode.Simulation
#if OVERRIDE || DEBUG
            System.Diagnostics.Debug.WriteLine("HACK-TEST -Convert");

            if (string.IsNullOrEmpty(fullFileName))
            {
                fullFileName = DefaultSourceFolder + "test.xml";
            }
#endif
            #endregion //////////////END TEST

            string xml      = File.ReadAllText(fullFileName);
            var    catalog1 = xml.ParseXML <TestCase>();

            string myScript = string.Empty;
            //get first
            var sel = catalog1;//.FirstOrDefault();

            MyActions = new List <CodeceptAction>();
            var length = sel.selenese.Count();
            for (int i = 0; i < length; i++)
            {
                var t = sel.selenese[i];
                Console.WriteLine(string.Format("{0}  {1}  {2}", t.command, t.target, t.value));

                var script = Codecept.Script(t, this);

                myScript += script;

                //create codeceptActions
                CodeceptAction action = new CodeceptAction
                {
                    target  = t.target,
                    command = t.command,
                    value   = t.value,
                    Script  = script.Trim(),
                    OrderNo = i
                };
                MyActions.Add(action);
            }//end for

            //LogApplication.Agent.LogInfo(myScript);
            System.Diagnostics.Debug.WriteLine(Environment.NewLine + myScript);
            StringBuilder result = new StringBuilder();
            return(result);
        }
Ejemplo n.º 2
0
        public override StringBuilder ReadXmlFile(string fullFileName = "")
        {
            try
            {
                //Load default??
                #region ---if null file found...


                Console.WriteLine("HACK-TEST -Convert");

                if (string.IsNullOrEmpty(fullFileName))
                {
                    fullFileName = DefaultSourceFolder + "test.xml";
                }


                #endregion //////////////END TEST

                string xml      = File.ReadAllText(fullFileName);
                var    catalog1 = xml.ParseXML <TestCase>();

                string myScript = string.Empty;
                //get first
                var sel = catalog1;//.FirstOrDefault();

                MyActions = new List <CodeceptAction>();
                var length = sel.selenese.Count();
                for (int i = 0; i < length; i++)
                {
                    var t = sel.selenese[i];
                    Console.WriteLine(string.Format("{0}  {1}  {2}", t.command, t.target, t.value));

                    var script = Codecept.Script(t, this);

                    myScript += script;

                    //create codeceptActions
                    CodeceptAction action = new CodeceptAction
                    {
                        target  = t.target,
                        command = t.command,
                        value   = t.value,
                        Script  = script.Trim(),
                        OrderNo = i
                    };
                    MyActions.Add(action);
                }//end for

                //LogApplication.Agent.LogInfo(myScript);
                Console.WriteLine(Environment.NewLine + myScript);
                StringBuilder result = new StringBuilder();
                return(result);
            }
            catch (Exception err)
            {
                LogApplication.Agent.LogError(err);
                // throw;
            }

            //error or null
            return(new StringBuilder());
        }