ps:该文章是进阶篇,如果对airtest没有任何了解的,可以先看下【入门篇】https://www.cnblogs.com/zhangxue521/p/14874848.html
然后再看本章内容
一、项目目录

二、各文件说明
1、air_case。需要执行的脚本air文件,例如login.air。后续直接添加该文件即可,其他的文件都不用动
2、export_log。该文件夹自动生成,是自动导出的日志,发给其他人的时候,直接发送该包,日志中的路径用的相对路径。可以直接找到文件
3、log。该文件夹自动生成,是运行中产生的log.txt文件
4、my_runner.py。运行case的启动器,整个demo的入口文件。【一般报错的都是这个文件】已经将这个文件改成使用导出模板的方式
5、report.py。生成报告入口,但是my_runner.py已经运行完case,生成了报告,无需再执行此文件
6、summary_template.html。汇总报告的模版,执行完case汇总的报告是根据该文件的样式产生的。
7、util.py。工具
三、运行方式
python3 my_runner.py
四、 说明
需要连接设备的直接在my_runner.py执行脚本中,添加devices即可。
怎么获取device数据,稍后更新airtest的小白教程。
五、各文件源码
my_runner.py文件
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # @Time : 2020-02-23 13:33
4 # @Author : zhangxue
5 # @File : my_runner1.py
6 # @Desc :
7 #!/usr/bin/env python
8 # -*- coding: utf-8 -*-
9 from airtest.cli.runner import AirtestCase, run_script
10 from argparse import *
11 import airtest.report.report as report
12 import jinja2
13 import shutil
14 import os
15 import io
16 from lib import Send_email
17 import os.path
18
19 class CustomAirtestCase(AirtestCase):
20 # @classmethod
21 # def setUpClass(cls):
22 # super(CustomAirtestCase,cls).setUpClass()
23
24
25 def setUp(self):
26 print("custom setup")
27 super(CustomAirtestCase, self).setUp()
28
29 def tearDown(self):
30 print("custom tearDown")
31 super(CustomAirtestCase, self).setUp()
32
33 def run_air(self, root_dir='', device=[], scriptname='air_case'):
34 # 用例目录
35 # script_path = root_dir + "/" + scriptname
36