//Descontinuada
        //private int Convert.ToInt32(NpgsqlDataReader dr)
        //{
        //    if (dr != null)
        //    {
        //        if (dr.HasRows && dr.Read())
        //        {
        //            int id = Convert.ToInt32(dr["ID"].ToString());
        //            dr.Close();
        //            return id;
        //        }
        //        else
        //        {
        //            return 0;
        //        }

        //    }
        //    else
        //    {
        //        return 0;
        //    }
        //}
        public int StartTest(string customerName, string suiteName, string scenarioName, string testName, string testType, string analystName, string testDesc, int ReportID = 0, int deleteFlag = 1)
        {
            Print("", null);
            customerName = Slugify(customerName);
            CstID        = Convert.ToInt32(Call("arch.update_cst", "customer:" + customerName));
            Print("Customer ID: " + CstID.ToString() + " [ " + customerName + " ]", null);
            SuiteName = Slugify(suiteName);
            SitID     = Convert.ToInt32(Call("auto.update_sit", "cst_id:" + CstID.ToString(), "suite:" + SuiteName));
            Print("Suite ID: " + SitID.ToString() + " [ " + suiteName + " ]", null);
            ScenarioName = Slugify(scenarioName);
            ScnID        = Convert.ToInt32(Call("auto.update_scn", "cst_id:" + CstID.ToString(), "scenario:" + ScenarioName));
            Print("Scenario ID: " + ScnID.ToString() + " [ " + ScenarioName + " ]", null);
            TestName    = Slugify(testName);
            TestType    = testType;
            TestDesc    = testDesc;
            AnalystName = analystName;
            TstID       = Convert.ToInt32(Call("auto.update_tst", "cst_id:" + CstID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "test:" + TestName, "type:" + TestType, "desc:" + TestDesc, "analyst:" + AnalystName));
            Print("Test ID: " + TstID.ToString() + " [ " + TestName + " ]", null);
            Print("", null);

            if (ReportID != 0 && deleteFlag == 1)
            {
                Call("auto.delete_rpt", "cst_id:" + CstID.ToString(), "rpt_id:" + ReportID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id:" + TstID.ToString());
            }
            if (TemConexao)
            {
                RptID = Convert.ToInt32(Call("auto.update_rpt", "cst_id:" + CstID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id:" + TstID.ToString(), "rpt_id:" + ReportID.ToString(), "status:pendente"));
                if (RptID == 0)
                {
                    return(0);
                }
                ;
            }
            else
            {
                RptID = ReportID;
            }
            Print("Report ID: " + RptID.ToString(), null);
            if (deleteFlag == 1)
            {
                Call("auto.delete_lgs", "cst_id:" + CstID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id:" + TstID.ToString(), "rpt_id:" + RptID.ToString());
                Call("auto.delete_stp", "cst_id:" + CstID.ToString(), "tst_id:" + TstID.ToString());
            }
            return(RptID);
        }
Beispiel #2
0
 public int StartTest(string customerName, string suiteName, string scenarioName, string testName, string testType, string analystName, string testDesc, int reportID = 0, int deleteFlag = 1, string statusType = "worst")
 {
     try
     {
         if (Connected == false)
         {
             Print("--------------------------------------------------------------------------------", null);
             Print("  Report Database Offline", null);
         }
         Print("--------------------------------------------------------------------------------", null);
         CustomerName = Slugify(customerName);
         CstID        = Convert.ToInt32(Call("arch.update_cst", "customer:" + CustomerName));
         Print("  Customer ID: " + CstID.ToString() + " [" + CustomerName + "]", null);
         SuiteName = Slugify(suiteName);
         SitID     = Convert.ToInt32(Call("auto.update_sit", "cst_id:" + CstID.ToString(), "suite:" + SuiteName));
         Print("     Suite ID: " + SitID.ToString() + " [" + SuiteName + "]", null);
         ScenarioName = Slugify(scenarioName);
         ScnID        = Convert.ToInt32(Call("auto.update_scn", "cst_id:" + CstID.ToString(), "scenario:" + ScenarioName));
         Print("  Scenario ID: " + ScnID.ToString() + " [" + ScenarioName + "]", null);
         TestName    = Slugify(testName);
         TestType    = testType;
         TestDesc    = testDesc;
         AnalystName = analystName;
         TstID       = Convert.ToInt32(Call("auto.update_tst", "cst_id:" + CstID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "test:" + TestName, "type:" + TestType, "desc:" + TestDesc, "analyst:" + AnalystName, "status:" + statusType));
         Print("      Test ID: " + TstID.ToString() + " [" + TestName + "]", null);
         Print("--------------------------------------------------------------------------------", null);
         if (deleteFlag == 1)
         {
             if (ReportID != 0)
             {
                 Call("auto.delete_rpt", "cst_id:" + CstID.ToString(), "rpt_id:" + reportID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id:" + TstID.ToString());
                 Call("auto.delete_lgs", "cst_id:" + CstID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id:" + TstID.ToString(), "rpt_id:" + reportID.ToString());
             }
             Call("auto.delete_stp", "cst_id:" + CstID.ToString(), "tst_id:" + TstID.ToString());
         }
         RptID = Convert.ToInt32(Call("auto.update_rpt", "cst_id:" + CstID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id:" + TstID.ToString(), "rpt_id:" + reportID.ToString(), "status:pendente"));
         Print("    Report ID: " + RptID.ToString(), null);
         Print("--------------------------------------------------------------------------------", null);
         return(RptID);
     }
     catch (Exception ex)
     {
         throw new Exception(Print("Exception at StartTest", ex));
     }
 }
        public int StartStep(string desc, int turn = 1, string status = "executando", string logMsg = "", string paramName = "", string paramValue = "")
        {
            try
            {
                if (this.CstID == 0)
                {
                    throw new Exception(Print("StartStep(CstID=0)", null));
                }
                if (this.SitID == 0)
                {
                    throw new Exception(Print("StartStep(SitID=0)", null));
                }
                if (this.ScnID == 0)
                {
                    throw new Exception(Print("StartStep(ScnID=0)", null));
                }
                if (this.TstID == 0)
                {
                    throw new Exception(Print("StartStep(TstID=0)", null));
                }
                if (this.RptID == 0)
                {
                    throw new Exception(Print("StartStep(RptID=0)", null));
                }

                if (status == "executando")
                {
                    string logLine = "  Step " + GetStepNumber(desc).ToString() + "." + turn.ToString() + ": " + desc;
                    if (logMsg != "" || paramName != "")
                    {
                        logLine = logLine + " (";
                        if (logMsg != "")
                        {
                            logLine = logLine + "Obs: " + logMsg;
                            if (paramName != "")
                            {
                                logLine = logLine + " - ";
                            }
                        }
                        if (paramName != "")
                        {
                            logLine = logLine + "Parameter: " + paramName + " = " + paramValue;
                            logLine = logLine + ")";
                        }
                    }
                    Print("StartStep('')", null);
                    Print("StartStep(" + logLine + ")", null);
                }
                return(Convert.ToInt32(Call("auto.update_lgs", "cst_id:" + CstID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id:" + TstID.ToString(), "rpt_id:" + RptID.ToString(), "dsc:" + desc, "turn_id:" + turn.ToString(), "status:" + status, "log_msg:" + logMsg, "param_name:" + paramName, "param_value:" + paramValue)));
            }
            catch (Exception ex)
            {
                throw new Exception(Print("StartStep", ex));
            }
        }
 public int DoStep(string desc, string expected_result = "", string status = "active", int newStep = 1)
 {
     try
     {
         if (this.CstID == 0)
         {
             throw new Exception(Print("DoStep(CstID=0)", null));
         }
         if (this.SitID == 0)
         {
             throw new Exception(Print("DoStep(SitID=0)", null));
         }
         if (this.ScnID == 0)
         {
             throw new Exception(Print("DoStep(ScnID=0)", null));
         }
         if (this.TstID == 0)
         {
             throw new Exception(Print("DoStep(TstID=0)", null));
         }
         if (this.RptID == 0)
         {
             throw new Exception(Print("DoStep(RptID=0)", null));
         }
         StepNumber = Convert.ToInt32(Call("auto.update_stp", "cst_id:" + CstID.ToString(), "tst_id:" + TstID.ToString(), "dsc:" + desc, "expected_result:" + expected_result, "status:" + status));
         if (newStep == 1)
         {
             Call("auto.delete_lgs", "cst_id:" + CstID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id:" + TstID.ToString(), "rpt_id:" + RptID.ToString(), "description:" + desc);
         }
         Call("auto.count_stp", "cst_id:" + CstID.ToString(), "tst_id:" + TstID.ToString());
         StartStep(desc, 1, status = "pendente");
         return(StepNumber);
     }
     catch (Exception ex)
     {
         throw new Exception(Print("DoStep", ex));
     }
 }
 public void DoTest(string pre = "", string post = "", string inputData = "", int steps = 0)
 {
     try
     {
         if (this.CstID == 0)
         {
             throw new Exception(Print("DoTest [ CstID=0 ]", null));
         }
         if (this.SitID == 0)
         {
             throw new Exception(Print("DoTest [ SitID=0 ]", null));
         }
         if (this.ScnID == 0)
         {
             throw new Exception(Print("DoTest [ ScnID=0 ]", null));
         }
         if (this.TstID == 0)
         {
             throw new Exception(Print("DoTest [ TstID=0 ]", null));
         }
         Call("auto.update_tst_details", "cst_id:" + CstID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id: " + TstID.ToString(), "pre:" + pre, "post:" + post, "input_data:" + inputData, "steps_id:" + steps.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception(Print("DoTest", ex));
     }
 }
Beispiel #6
0
 public void EndTest(int reportID = 0, string status = "pronto", bool deleteReport = false)
 {
     try
     {
         if (CstID == 0)
         {
             throw new Exception(Print("EndTest [CstID=0]", null));
         }
         if (RptID == 0)
         {
             throw new Exception(Print("EndTest [RptID=0]", null));
         }
         if (SitID == 0)
         {
             throw new Exception(Print("EndTest [SitID=0]", null));
         }
         if (ScnID == 0)
         {
             throw new Exception(Print("EndTest [ScnID=0]", null));
         }
         if (TstID == 0)
         {
             throw new Exception(Print("EndTest [TstID=0]", null));
         }
         if (deleteReport == true || reportID == 0)
         {
             Call("auto.delete_rpt", "cst_id:" + CstID.ToString(), "rpt_id:" + RptID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id:" + TstID.ToString());
         }
         Print("--------------------------------------------------------------------------------", null);
         GetReportURL();
         Print("--------------------------------------------------------------------------------", null);
         if (Conn.ConnOpened())
         {
             Conn.CloseConn();
         }
     }
     catch (Exception ex)
     {
         Print("Exception at EndTest", ex);
     }
 }
Beispiel #7
0
 public int StartStep(string stepDesc, int turn = 0, string status = "executando", string logMsg = "", string paramName = "", string paramValue = "")
 {
     try
     {
         if (CstID == 0)
         {
             throw new Exception(Print("StartStep [CstID=0]", null));
         }
         if (SitID == 0)
         {
             throw new Exception(Print("StartStep [SitID=0]", null));
         }
         if (ScnID == 0)
         {
             throw new Exception(Print("StartStep [ScnID=0]", null));
         }
         if (TstID == 0)
         {
             throw new Exception(Print("StartStep [TstID=0]", null));
         }
         if (RptID == 0)
         {
             throw new Exception(Print("StartStep [RptID=0]", null));
         }
         StepName = stepDesc;
         if (turn == 0)
         {
             StepTurn = NextTurn(GetStepNumber(StepName));
         }
         else
         {
             StepTurn = turn;
         }
         if (status == "executando")
         {
             string logLine = "  Step " + GetStepNumber(StepName).ToString() + "." + StepTurn.ToString() + ": " + StepName;
             if (logMsg != "" || paramName != "")
             {
                 logLine = logLine + " (";
                 if (logMsg != "")
                 {
                     logLine = logLine + "Obs: " + logMsg;
                     if (paramName != "")
                     {
                         logLine = logLine + " - ";
                     }
                 }
                 if (paramName != "")
                 {
                     logLine = logLine + "Parameter: " + paramName + " = " + paramValue;
                 }
                 logLine = logLine + ")";
             }
             Print(logLine, null);
         }
         return(Convert.ToInt32(Call("auto.update_lgs", "cst_id:" + CstID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id:" + TstID.ToString(), "rpt_id:" + RptID.ToString(), "dsc:" + StepName, "turn_id:" + StepTurn.ToString(), "status:" + status, "log_msg:" + logMsg, "param_name:" + paramName, "param_value:" + paramValue)));
     }
     catch (Exception ex)
     {
         throw new Exception(Print("Exception at StartStep", ex));
     }
 }
Beispiel #8
0
 public int NextTurn(int stepNumber, string mode = "add")
 {
     try
     {
         if (CstID == 0)
         {
             throw new Exception(Print("NextTurn [CstID=0]", null));
         }
         if (RptID == 0)
         {
             throw new Exception(Print("NextTurn [RptID=0]", null));
         }
         if (SitID == 0)
         {
             throw new Exception(Print("NextTurn [SitID=0]", null));
         }
         if (ScnID == 0)
         {
             throw new Exception(Print("NextTurn [ScnID=0]", null));
         }
         if (TstID == 0)
         {
             throw new Exception(Print("NextTurn [TstID=0]", null));
         }
         if (Connected)
         {
             StepTurn = Convert.ToInt32(Call("auto.get_trn_num", "cst_id:" + CstID.ToString(), "rpt_id:" + RptID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id:" + TstID.ToString(), "step_id:" + stepNumber.ToString()));
             if (mode == "add")
             {
                 StepTurn += 1;
             }
         }
         else
         {
             StepTurn = LocalTurn(TestName, StepName, mode);
         }
         return(StepTurn);
     }
     catch (Exception ex)
     {
         throw new Exception(Print("Exception at NextTurn", ex));
     }
 }
Beispiel #9
0
 public int DoStep(string stepDesc, string expectedResult = "", string status = "active", int newStep = 1)
 {
     try
     {
         if (CstID == 0)
         {
             throw new Exception(Print("DoStep [CstID=0]", null));
         }
         if (SitID == 0)
         {
             throw new Exception(Print("DoStep [SitID=0]", null));
         }
         if (ScnID == 0)
         {
             throw new Exception(Print("DoStep [ScnID=0]", null));
         }
         if (TstID == 0)
         {
             throw new Exception(Print("DoStep [TstID=0]", null));
         }
         if (RptID == 0)
         {
             throw new Exception(Print("DoStep [RptID=0]", null));
         }
         if (Connected)
         {
             StepNumber = Convert.ToInt32(Call("auto.update_stp", "cst_id:" + CstID.ToString(), "tst_id:" + TstID.ToString(), "dsc:" + stepDesc, "expected_result:" + expectedResult, "status:" + status));
         }
         else
         {
             StepNumber = LocalTurn(TestName + "_DoStep", stepDesc + "_DoStep");
         }
         if (newStep == 1)
         {
             Call("auto.delete_lgs", "cst_id:" + CstID.ToString(), "sit_id:" + SitID.ToString(), "scn_id:" + ScnID.ToString(), "tst_id:" + TstID.ToString(), "rpt_id:" + RptID.ToString(), "description:" + stepDesc);
             StartStep(stepDesc, 1, status = "pendente");
         }
         Call("auto.count_stp", "cst_id:" + CstID.ToString(), "tst_id:" + TstID.ToString());
         return(StepNumber);
     }
     catch (Exception ex)
     {
         throw new Exception(Print("Exception at DoStep", ex));
     }
 }