예제 #1
0
        public static void StoreInDB(
            string Scenario,
            string PageName,
            string ElementName,
            string TestDescription,
            TestResult TestStatus)
        {
            SeleniumStatus seleniumStatus = new SeleniumStatus();

            seleniumStatus.Scenario        = Scenario + " - Dataset " + (object)Common.RowNumber;
            seleniumStatus.PageName        = PageName;
            seleniumStatus.ElementName     = ElementName;
            seleniumStatus.TestDescription = TestDescription;
            seleniumStatus.TestStatus      = TestStatus.ToString();
            seleniumStatus.UserName        = WindowsIdentity.GetCurrent().Name;
            seleniumStatus.TestID          = ExecuteTest.TestID;
            seleniumStatus.ParentID        = "";
            if (Common.Screenshot == null || TestStatus.ToString() == "Success")
            {
                seleniumStatus.Screenshot = " ";
                seleniumStatus.FailureURL = " ";
            }
            else
            {
                seleniumStatus.Screenshot = Common.Screenshot;
                seleniumStatus.FailureURL = Common.FailureURL;
            }
            Guid guid = TestRun.GetAll().Where <TestRun>((Func <TestRun, bool>)(run => run.ExecutedTime.ToString() == ExecuteTest.scenarioTime.ToString())).Select <TestRun, Guid>((Func <TestRun, Guid>)(run => run.TestRunID)).FirstOrDefault <Guid>();

            seleniumStatus.TestRunID = guid;
            Persistance.Create((object)seleniumStatus);
        }