zoukankan      html  css  js  c++  java
  • android模拟器(genymotion)+appium+python 框架执行基本原理(目前公司自己写的)

    android模拟器(genymotion)+appium+python 框架执行的基本过程:

    1、Push.initDate(openid)方法     //业务数据初始化

      1.1   v5db.push_to_db(filename, openid) //通过执行filename文件里sql语句,使业务数据初始化,比如物理删除订单,以确保不会因为数据原因导致自动化执行失败

    2、Android.Android.init_Android(self)  //初始化Android模拟器 

    class android:
        def init_Android(self):
            try:   
                desired_caps = {}
                desired_caps['deviceName'] = 'device'  
                desired_caps['platformName'] = 'Android'
                desired_caps['platformVersion'] = '4.3'  
                desired_caps['app'] = PATH('D:\Workspace\projectName_app_appium_testprojectNameApp\agent4.0.0_test.apk') 
           desired_caps[
    'appPackage'] = 'com.***.finance.agent'
           desired_caps[
    'appActivity'] = 'com.***.finance.agent.LuncherActivity'
           desired_caps[
    'unicodeKeyboard'] = 'True'
           desired_caps[
    'resetKeyboard'] = 'True'
      
         return desired_caps

    except Exception,ex:

    print ex

    3、web.Web.webPath(self, androidMap)     //将app相关信息塞到远程虚拟机运行的appium上,从而获得期望的driver

      driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', androidMap)

    4、Push.controller(driver)   //正式开始执行case

      4.1 读取case映射表,映射出case的描述

      4.2 if执行case在映射表中可以匹配到,则 按行读取case文件内容,并处理case内容 

              处理case内容,分别获得执行时所需参数1)ids_key->ids:元素id    2)ele_type:元素类型    3)input_Value:输入内容  4)msg:步骤描述信息  5)assert_message:校验信息

      4.3 调用Push.fillElement(driver,ids,ele_type,input_Value,msg,assert_message)   //定位元素,并对其进行操作

             4.3.1 定位元素

       4.3.2 对元素进行操作

       4.3.3 Push.checkResut(driver, times,  msg, assertMsg, input_value)  //写元素操作日志

    5、case文件执行完成,driver。quit()  //关闭driver

    6、push.logInfo(time)   //输出case测试报告

  • 相关阅读:
    探究 encode 和 decode 的使用问题(Python)
    C语言结构体在内存中的存储情况探究------内存对齐
    文件基本操作 (C语言)
    利用Xamaria构建Android应用-公交发车信息屏
    ChakraCore ,Net托管编程
    Go并发与.Net TAP
    码农视角
    让isis支持高德地图
    Fedora Server 上配置 MariaDb 集群
    .Net Sokcet 异步编程
  • 原文地址:https://www.cnblogs.com/wangcp-2014/p/5692783.html
Copyright © 2011-2022 走看看