Esempio n. 1
0
        public static AutoConfig GetInstance()
        {
            if (_autoConfig == null)
            {
                _autoConfig = new AutoConfig();
            }

            return(_autoConfig);
        }
Esempio n. 2
0
        public CoreEngine(AutoConfig config, Parser parser)
        {
            if (config == null || parser == null)
            {
                throw new ArgumentNullException("AutoConfig and/or KeywordParser can not be null.");
            }

            this._autoConfig = config;
            this._parser     = parser;

            this.OnNewMessage += new _frameworkInfoDelegate(WriteMsgToConsole);
        }
Esempio n. 3
0
        /* void InitProject()
         * Init AutoConfig and Parser to parse config file and driver file.
         *
         */
        private void InitProject()
        {
            _autoConfig = AutoConfig.GetInstance();
            _autoConfig.ProjectConfigFile = this._projectConfigFile;

            //if user input the framework config file, we will use it,
            // or we will search the framework config file in current folder.
            if (!String.IsNullOrEmpty(this._frameworkConfigFile))
            {
                _autoConfig.FrameworkConfigFile = this._frameworkConfigFile;
            }

            _autoConfig.ParseConfigFile();
            _autoConfig.Close();

            _parser            = Parser.GetInstance();
            _parser.AutoConfig = _autoConfig;

            _parser.ParseDriveFile();
            _parser.Close();
        }
Esempio n. 4
0
        /* void GetAllDLLPath()
         * Get the dll path from framework config file.
         */
        private static void GetAllDllPath()
        {
            if (String.IsNullOrEmpty(_testObjPoolDLL))
            {
                try
                {
                    AutoConfig config = AutoConfig.GetInstance();

                    string domain = config.ProjectDomain;

                    string currentPath = Application.StartupPath;// Assembly.GetExecutingAssembly().Location;
                    currentPath = Path.GetDirectoryName(currentPath);

                    PluginInfo tmp = config.GetTestPluginByDomain(domain);

                    _testAppDLL       = tmp._testAppDLL;
                    _testAppClassName = tmp._testApp;

                    _testBrowserDLL       = tmp._testBrowserDLL;
                    _testBrowserClassName = tmp._testBrowser;

                    _testObjPoolDLL          = tmp._testObjectPoolDLL;
                    _testObjectPoolClassName = tmp._testObjectPool;

                    _testActionDLL       = tmp._testActionDLL;
                    _testActionClassName = tmp._testAction;

                    _testVPDLL       = tmp._testVPDLL;
                    _testVPClassName = tmp._testVP;

                    //default , we think it is web application.
                    _appType = 1;

                    bool isApp = false;

                    //if the <TestApp> text in config file is not empty, we think it is desktop application.
                    if (!String.IsNullOrEmpty(_testAppDLL))
                    {
                        _appType = 2;
                        isApp    = true;
                    }
                    else
                    {
                        if (String.IsNullOrEmpty(_testBrowserDLL))
                        {
                            _appType = 0;

                            throw new CannotLoadDllException(" Test app and Test browser can not be null.");
                        }
                    }

                    bool allFound = true;

                    //search each dll
                    if (isApp)
                    {
                        if (!SearchDll(currentPath, ref _testAppDLL))
                        {
                            allFound = false;
                        }
                    }
                    else
                    {
                        if (!SearchDll(currentPath, ref _testBrowserDLL))
                        {
                            allFound = false;
                        }
                    }

                    if (!SearchDll(currentPath, ref _testObjPoolDLL))
                    {
                        allFound = false;
                    }

                    if (!SearchDll(currentPath, ref _testActionDLL))
                    {
                        allFound = false;
                    }

                    if (!SearchDll(currentPath, ref _testVPDLL))
                    {
                        allFound = false;
                    }

                    if (!allFound)
                    {
                        throw new CannotLoadDllException("Can not find the plugin dll.");
                    }
                }
                catch (TestException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    throw new CannotLoadDllException("Can not find the dll path: " + ex.ToString());
                }
            }
        }