# -*- coding:utf-8 -*- ''' @project: ApiAutoTest @author: Jimmy @file: test_register.py @ide: PyCharm Community Edition @time: 2018-12-28 15:50 @blog: https://www.cnblogs.com/gotesting/ ''' import unittest import os from ddt import ddt,data from Comm…
工作中,使用python的requests库进行接口自动化测试是一个比较不错的选择,今天就以某网站的免费接口为例,展示以get请求进行批量执行测试用例.话不多说直接开讲 分析一下接口信息, 请求地址:http://apis.juhe.cn/simpleWeather/query, 请求参数:city和key,都是必传 请求方式:get或post,以下以get为例 返回结果:info,wid等 注意:该网站免费接口每天有请求次数限制,在调试的时候注意下不要超过规定次数,不然只能等到第二天才能使用了…
# -*- coding:utf-8 -*- ''' @project: ApiAutoTest @author: Jimmy @file: test_recharge.py @ide: PyCharm Community Edition @time: 2018-12-27 10:07 @blog: https://www.cnblogs.com/gotesting/ ''' import unittest import os from ddt import ddt,data from Comm…
# -*- coding:utf-8 -*- ''' @project: ApiAutoTest @author: Jimmy @file: test_login.py @ide: PyCharm Community Edition @time: 2018-12-22 09:33 @blog: https://www.cnblogs.com/gotesting/ ''' import unittest import os from ddt import ddt,data from Common.…
由于unittest框架中结果收集在不同文件中,所以此处重写结果收集方法,加入执行时间,失败信息,失败截图等 TestRunner.py # coding=utf-8 import sys import time import datetime import unittest from PIL import ImageGrab import random import ConfigParser import re import Logger log = Logger.Loger() TestRe…
测试用例基类: # coding=utf-8 import unittest import Logger log = Logger.Loger() class BaseCase(unittest.TestCase): def setUp(self): self.loginfo("============================================================") self.loginfo("%s is start" % sel…
接口公共方法有:数据引擎.http引擎.Excel引擎 1.数据引擎:获取用例.结果检查.结果统计 # -*- coding:utf-8 -*- from XlsEngine import XlsEngine_rd import os '''获取用例''' def getCase(): filepath = os.path.abspath('.') filename = filepath + "/interfacetest/Data/InterfaceData.xlsx" data =…
Python接口测试采用python读取excel的方法,通过requests库发送请求和接收响应.模块有: Data:用于存放excel用例的,用例格式: iutil: 接口公共方法,数据引擎.http引擎.Excel引擎,见 http://www.cnblogs.com/fengsiyi/articles/7206855.html models: 一些接口对象的封装 report: 报告 testcases: 具体测试用例实现 Python web功能&接口自动化测试框架搭建——接口用例实现…
功能测试使用selenium,模块有: 1.futil: 公共方法,如元素高亮显示 # coding=utf-8 """高亮显示元素""" def highLight(driver,element): js = ''' element = arguments[0]; element.setAttribute('style','border: 3px solid red;') ''' driver.execute_script(js,element…
1.通用模块: config.conf: 公共配置文件,配置报告.日志.截图路径,以及邮件相关配置 [report] reportpath = E:\workspace\WebAutomation\src\functiontest\Report\2017-07-18 screen_path = E:\workspace\WebAutomation\src\functiontest\Report\2017-07-18\Screenshoots report_path = E:\workspace\…