Esempio n. 1
0
        public override void Execute()
        {
            Console.WriteLine("{0}: Execute", GetType());

            using (IConnection session = ConnectionFactory.makeConnection())
            {
                IDBCommand cmd = session.getCommand("Z$SCRIPTS_LIB_API.mt_exec");
                cmd.withParam("P_SESSION_FILE_NAME", m_conf["SessionId"]);
                cmd.withParam("P_TEST_MT", m_conf["mt_test"]);
                cmd.withParam("P_CONDITION", m_conf["condition"]);
                cmd.Execute();

                session.Commit();
            };
        }
Esempio n. 2
0
        protected void internalInit()
        {
            string procName = "Z$ATT_TEST_SCRIPT_LIB.GenNewSession";

            DataTable dt = null;

            using (IbsoConnection conn = new IbsoConnection())
            {
                conn.Open();
                IDBCommand cmd = conn.getCommand(procName, testSet.Session.Timeout);
                cmd.withParam("p_ext_scr_code", ScenarioId);
                cmd.withCursor("P_XML_CLOB");
                cmd.withParam("p_contur", ConturId);
                cmd.withParam("p_profile", ProfileId);
                cmd.withParam("p_testset", TestSetId);
                cmd.withParam("p_jour_id", JournalId);
                cmd.withParam("p_log_path", logsFolder);
                dt = (DataTable)cmd.Execute();
                conn.Commit();
                conn.Close();
            }

            if (dt.Rows.Count != 1 || dt.Columns.Count != 2)
            {
                throw new TestRunException(String.Format("Вызов процедуры \"{0}\" вернул неверный набор данных. Вернулось строк: {1}, стобцов: {2}. Ожидалось строк: {3}, столбцов: {4}", procName, dt.Rows.Count, dt.Columns.Count, 1, 2));
            }

            string testRunId = dt.Rows[0][1].ToString();

            if (String.IsNullOrEmpty(testRunId))
            {
                throw new TestRunException("Не заполнено обязательное поле \"Имя файла сценария\"");
            }

            IDictionary <string, string> dict = new Dictionary <string, string>();

            dict.Add("testRunId", dt.Rows[0][1].ToString());
            m_conf.updateFrom(dict);

            XmlDocument doc = new XmlDocument();

            try
            {
                doc.LoadXml(dt.Rows[0][0].ToString());
            }
            catch (Exception e)
            {
                throw new TestRunException("Не удалось разобрать xml-содержимое файла сценария", e);
            }

            XmlNode test_node = doc.DocumentElement.FirstChild;

            while (test_node != null)
            {
                Dictionary <string, string> p = new Dictionary <string, string>();
                foreach (XmlAttribute attrib in test_node.Attributes)
                {
                    p.Add(attrib.Name, attrib.Value);
                }
                ITest t = new Test(this, p, test_node);
                m_testList.Add(t);
                test_node = test_node.NextSibling;
            }
        }
Esempio n. 3
0
        public IList <IDictionary <string, string> > getCases()
        {
            const string procName = "Z$att_test_script_lib.GETTESTS";


            List <IDictionary <string, string> > list = new List <IDictionary <string, string> >();

            Dictionary <string, string> dict = null;

            DataTable dt = new DataTable();

            using (IbsoConnection conn = new IbsoConnection(m_conf["db_user"], m_conf["db_password"], m_conf["db_name"]))
            {
                conn.Open();
                IDBCommand cmd = conn.getCommand(procName, Timeout);
                cmd.withParam("P_COMP", compName);
                cmd.withParam("P_USER", userName);
                cmd.withParam("P_RUN_ERR", failuresOnly);
                cmd.withCursor("P_RECORDSET");
                dt = (DataTable)cmd.Execute();
                conn.Commit();
                conn.Close();
            }

            foreach (DataRow r in dt.Rows)
            {
                dict = new Dictionary <string, string>();

                foreach (DataColumn c in dt.Columns)
                {
                    dict.Add(c.ColumnName, r[c].ToString());
                }

                list.Add(dict);
            }

            /*
             * if (dt.Columns.Count < 6)
             * {
             *  throw new Exception("Выполнение тест сета невозможно. При получении списка тестов получено " + dt.Columns.Count + " полей. Ожидалось не менее 6 полей");
             * }
             *
             * if (dt.Rows.Count > 0)
             * {
             *  for (int i = 0; i < dt.Rows.Count; i++)
             *  {
             *      ScenarioRunConfig config = new ScenarioRunConfig();
             *      config.TestSetId = dt.Rows[i][0].ToString();
             *      config.ScenarioId = dt.Rows[i][1].ToString();
             *      config.ProfileId = dt.Rows[i][2].ToString();
             *      config.ConturId = dt.Rows[i][3].ToString();
             *      string tuneErrString = dt.Rows[i][4].ToString();
             *      if (tuneErrString == null || tuneErrString.Equals("")) tuneErrString = "0";
             *      config.TuneErrRun = int.Parse(tuneErrString);
             *      config.JournalId = dt.Rows[i][5].ToString();
             *
             *      if (dt.Columns.Count > 6)
             *      {
             *          List<string> additionalValues = new List<string>();
             *          for (int k = 6; k < dt.Columns.Count; k++)
             *          {
             *              additionalValues.Add(dt.Rows[i][k].ToString());
             *          }
             *          config.AdditionalValues = additionalValues.ToArray();
             *      }
             *      else
             *      {
             *          config.AdditionalValues = new string[] { };
             *      }
             *
             *      res.Add(config);
             *  }
             * }*/

            return(list);
        }