Airtest网页自动化批量执行脚本

主要引用自这里:《Airtest自动化测试——批量执行脚本》

原文主要是针对App进行测试,我们稍微修改下,就可以使用于网页了。

1.每个文件夹的用途

 

2.conf/settings.py用于设置基础配置以及每个文件夹的路径。其中需要注意两个配置

deviceType = "web" #设置成web
devices = [] #对页面测试无效,所以不用管;只对App有效。

 

3.修改C:\Python37\Lib\site-packages\airtest\cli\runner.py中的函数(不修改的话只要有一个assert就退出执行了)

def run_script(parsed_args, testcase_cls=AirtestCase):
    global args  # make it global deliberately to be used in AirtestCase & test scripts
    args = parsed_args
    suite = unittest.TestSuite()
    suite.addTest(testcase_cls())
    result = unittest.TextTestRunner(verbosity=0).run(suite)
    if not result.wasSuccessful():
        #sys.exit(-1) #将这里屏蔽掉
        raise AssertionError #加上这一句

 

4.最后将Airtest写的项目文件放到air文件夹中,然后在cmd中运行Python runCase.py。

 

现将文件备份如下:

 https://files-cdn.cnblogs.com/files/chevin/Airtest_Runner.zip

 

以上。

 

posted @ 2020-08-27 20:40  pcwen.top  阅读(1448)  评论(0编辑  收藏  举报
pcwen.top