Esempio n. 1
0
        /// <summary>
        /// To get driver from session manager
        /// </summary>
        /// <param name="SessionName">Expected session</param>
        /// <returns>Object</returns>
        protected object GetInterface(string SessionName)
        {
            string strName = string.Format("{0}_{1}", SessionName, Position);

            try
            {
                object objSession = null;
                if (true == pISessionManagement.SessionExists(SessionName, Position))
                {
                    objSession = pISessionManagement.GetSessionByName(SessionName, Position);
                }
                else
                {
                    objSession = pISessionManagement.CreateSession(SessionName, Position);
                    //throw new Exception(string.Format("Can't find {0} in SessionManager.", strName));
                }
                ICommonComponent pICC = objSession as ICommonComponent;
                if (false == pICC.IsInitialized)
                {
                    pISessionManagement.InitializeSession(SessionName, Position);
                }

                return(objSession);
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("{0}->{1}", System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName, ex.Message));
            }
        }
Esempio n. 2
0
        public void PlanExecution()
        {
            List <TestItem>             listSequence   = CurrentPlan.Sequence;
            Dictionary <string, string> dictProperties = CurrentPlan.Properties;
            ISessionManagement          pISM           = null;

            try
            {
                #region relative set for the thread
                //inital log instance by sessionmanager
                if (hashCoreParams.ContainsKey(CommonTags.CoreData_SessionManage))
                {
                    pISM = (ISessionManagement)hashCoreParams[CommonTags.CoreData_SessionManage];
                }
                Log    logger         = new Log(DUTInfo);
                string strSessionName = "ILog";
                ///TODO:
                ///Log is necessary?
                if (true == pISM.AddSession(string.Format("{0}_{1}", strSessionName, DUTInfo.Position), logger))
                {
                    pISM.InitializeSession(strSessionName, DUTInfo.Position);
                }
                else
                {
                    throw new Exception(string.Format("{0} exists or session is not created.", strSessionName));
                }
                //object objLog = pISM.CreateSession("ILog", DUTInfo.Position); //create session and add it to sessionmanager


                #endregion


                foreach (TestItem tirItem in listSequence)
                {
                    //Timestampe of start
                    TimeSpan tsSpan;
                    //get info of current test

                    //call delegation for showing the next test
                    //TODO: implement delegations

                    ArrayList alOutputValue = RunningItem(tirItem);

                    //restore current indicator

                    //call delegation for reporting and showing test result
                    //TODO: implement delegations
                }
            }
            catch (Exception ex)
            {
                //TODO: Implement the exception handling
            }
        }