Example #1
0
        public string StartTestApp(string configDataPath)
        {
            string data = File.ReadAllText(configDataPath);

            JObject jdata = JObject.Parse(data);

            var config            = jdata["config"];
            var phoneConfig       = jdata["phoneConfig"];
            var appConfig         = jdata["appConfig"];
            var test              = jdata["testData"];
            var testResaultConfig = jdata["resaultConfig"];

            Config.Instance.SetConfig((JObject)config);
            _phoneConfig = new PhoneConfig((JObject)phoneConfig);
            _appConfig   = new AppConfig((JObject)appConfig);

            _connector = new Connector(_phoneConfig, _appConfig);

            _test = new Test((JArray)test);

            _testResault = new TestResault((JObject)testResaultConfig);

            _connector.Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3);

            _test.startTest();

            return(_testResault.CheckResault());
        }
Example #2
0
        public TestResault(JObject config)
        {
            string resaultType = (string)config["resaultType"];

            _resaultType = TestResault.ParseResaultType(resaultType);

            string getElementBy      = (string)config["by"];
            string getElementByValue = (string)config["elementName"];

            _by   = getElementBy;
            _name = getElementByValue;

            _screenShooAfterEveryStep = (bool)config["screenShootAfterEveryStep"];

            _uIElement = UIElement.GetElement(getElementByValue, UIElement.ParseFindElementBy(getElementBy, getElementByValue));

            if (_resaultType == ResaultType.VALUE)
            {
                _value = (string)config["resultValue"];
            }
            else
            {
                _screenShotFileName = (string)config["screenShotFileName"];
            }
        }
Example #3
0
        public bool InitTest(Config config, PhoneConfig phoneConfig, AppConfig appConfig, TestResault testResault)
        {
            Config.Instance.SetConfig(config);
            _phoneConfig = phoneConfig;
            _appConfig   = appConfig;
            _testResault = testResault;

            try
            {
                _connector = new Connector(_phoneConfig, _appConfig);
                _test      = new Test();
            }catch (Exception e)
            {
                _connector = null;
                _test      = null;
                return(false);
            }

            return(true);
        }