Ejemplo n.º 1
0
        private static int LogResult(int runExecutionId, int batchId, int scenarioId, int testId, int stepId,
                                     string description, int status, string outOfFlow, int projectId, int projectPageId)
        {
            int      result;
            DateTime occurred = DateTime.Now.ToUniversalTime();

            using (var adapterLogresult = new TestResultsTableAdapter())
            {
                result = adapterLogresult.Insert(runExecutionId, batchId, scenarioId, testId, stepId, description,
                                                 status, outOfFlow, projectId, projectPageId, occurred);
            }
            if (status == Constants.Passed)
            {
                Logger.Passed(runExecutionId + "," + batchId + "," + scenarioId + "," + testId + "," + stepId + "," +
                              description + "," + status + "," + outOfFlow + "," + projectId + "," + projectPageId);
            }
            if (status == Constants.Done)
            {
                Logger.Done(runExecutionId + "," + batchId + "," + scenarioId + "," + testId + "," + stepId + "," +
                            description + "," + status + "," + outOfFlow + "," + projectId + "," + projectPageId);
            }
            if (status == Constants.Failed)
            {
                Logger.Failed(runExecutionId + "," + batchId + "," + scenarioId + "," + testId + "," + stepId + "," +
                              description + "," + status + "," + outOfFlow + "," + projectId + "," + projectPageId);
            }

            return(result);
        }
Ejemplo n.º 2
0
        public void ObRegression()
        {
            var adapterTestresult   = new TestResultsTableAdapter();
            int runExecutionId      = Convert.ToInt32(adapterTestresult.LastRunExecutionID()) + 1;
            ExecutionManager em     = new ExecutionManager(runExecutionId);
            bool             result = em.ExecuteOneBatch(ConfigurationManager.AppSettings["BatchToExecute"]);

            Assert.AreEqual(true, result, "The Gui Automation failed , please check Applenium log and snapshots on build machine");
        }
Ejemplo n.º 3
0
        public void ObRegression()
        {
            var adapterTestresult   = new TestResultsTableAdapter();
            int runExecutionId      = (Int32)(DateTime.Now.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
            ExecutionManager em     = new ExecutionManager(runExecutionId);
            bool             result = em.ExecuteOneBatch(ConfigurationManager.AppSettings["BatchToExecute"]);

            Assert.AreEqual(true, result, "The Gui Automation failed , please check Applenium log and snapshots on build machine");
        }
Ejemplo n.º 4
0
        private int insertToDB(LogObject log)
        {
            int      result   = -1;
            DateTime occurred = DateTime.Now.ToUniversalTime();

            // Insert log to database
            using (var adapterLogresult = new TestResultsTableAdapter())
            {
                result = adapterLogresult.Insert(log.ExecutionID, log.BatchID, log.ScenarioID, log.TestID, log.StepID, log.Description,
                                                 log.StatusTag, "0", log.ProjectID, log.ProjectPageID, occurred);
            }


            return(result);
        }
Ejemplo n.º 5
0
        internal int LogResult(int runExecutionId, int batchId, int scenarioId, int testId, int stepId,
                               string description, int status, string outOfFlow, int projectId, int projectPageId)
        {
            try
            {
                int      result;
                string   batchName       = string.Empty;
                string   scenarioName    = string.Empty;
                string   testName        = string.Empty;
                string   stepName        = string.Empty;
                string   projectName     = string.Empty;
                string   projectPageName = string.Empty;
                DateTime occurred        = DateTime.Now.ToUniversalTime();
                using (var adapterLogresult = new TestResultsTableAdapter())
                {
                    result = adapterLogresult.Insert(runExecutionId, batchId, scenarioId, testId, stepId, description,
                                                     status, outOfFlow, projectId, projectPageId, occurred);
                }

                using (var adapterBatch = new BatchesTableAdapter())
                {
                    if (batchId != 0)
                    {
                        batchName = adapterBatch.GetBatchName(batchId);
                    }
                    else
                    {
                        batchName = Constants.LogNothing;
                    }
                }

                using (var adapterScenario = new ScenarioTableAdapter())
                {
                    if (scenarioId != 0)
                    {
                        scenarioName = adapterScenario.GetScenarioName(scenarioId);
                    }
                    else
                    {
                        scenarioName = Constants.LogNothing;
                    }
                }

                using (var adapterTest = new TestTableAdapter())
                {
                    if (testId != 0)
                    {
                        testName = adapterTest.GetTestName(testId);
                    }
                    else
                    {
                        testName = Constants.LogNothing;
                    }
                }

                using (var adapterGuiMap = new GuiMapTableAdapter())
                {
                    if (stepId != 0)
                    {
                        stepName = adapterGuiMap.GetGuiMapName(stepId).Trim();
                    }
                    else
                    {
                        stepName = Constants.LogNothing;
                    }
                }

                using (var adapterProject = new ProjectsTableAdapter())
                {
                    if (projectId != 0)
                    {
                        projectName = adapterProject.GetProjectName(projectId);
                    }
                    else
                    {
                        projectName = Constants.LogNothing;
                    }
                }

                using (var adapterProjectPage = new GuiProjectPageTableAdapter())
                {
                    if (projectPageId != 0)
                    {
                        projectPageName = adapterProjectPage.GetProjectPageName(projectPageId);
                    }
                    else
                    {
                        projectPageName = Constants.LogNothing;
                    }
                }


                string logString = String.Format("{0}={1}\t{2}={3}\t{4}={5}\t{6}={7}\t{8}={9}\t{10}=( {11} )\t{12}={13}\t{14}={15}",
                                                 Constants.LogExecutionId, runExecutionId,
                                                 Constants.LogBatchName, batchName,
                                                 Constants.LogScenarioName, scenarioName,
                                                 Constants.LogTestName, testName,
                                                 Constants.LogStepName, stepName,
                                                 Constants.LogDescription, description,
                                                 Constants.LogProjectName, projectName,
                                                 Constants.LogProjectPageName, projectPageName);
                if (status == Constants.Passed)
                {
                    Logger.Passed(logString);
                }
                if (status == Constants.Done)
                {
                    Logger.Done(logString);
                }
                if (status == Constants.Failed)
                {
                    Logger.Failed(logString);
                }

                return(result);
            }
            catch (Exception exception)
            {
                Logger.Error(exception.Message, exception);
                return(0);
            }
        }