Esempio n. 1
0
casename = 'Web'
reader.open_excel('./lib/%s.xls' % casename)
writer = Writer()
writer.copy_open('./lib/%s.xls' % casename, './lib/result-%s.xls' % casename)

sheetname = reader.get_sheets()
writer.set_sheet(sheetname[0])
starttime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))
writer.write(1, 3, starttime)
reader.readline()
casetype = reader.readline()[1]
# 执行用例的关键字库对象
obj = None
if casetype == 'HTTP' or casetype == '':
    # 执行http接口自动化
    obj = HTTP(writer)
elif casetype == 'SOAP':
    obj = SOAP(writer)
elif casetype == 'WEB':
    obj = Web(writer)
elif casetype == 'APP':
    obj = App(writer)

for sheet in sheetname:
    # 设置当前读取的sheet页面
    reader.set_sheet(sheet)
    # 读到哪个sheet页,写到哪个sheet页
    writer.set_sheet(sheet)
    for i in range(reader.rows):
        line = reader.readline()
        # 读到哪一行,写到哪一行
Esempio n. 2
0
# coding=utf-8
from inter.interkeys import HTTP

# 创建一个http请求库的实例对象
http = HTTP()
# 设置基础url地址
# http.url = 'http://112.74.191.10:80/inter/HTTP/'
http.seturl('http://112.74.191.10:80/inter/HTTP/')
http.post('auth', '')
# 保存token
http.savejson('token', 'token')
# 添加token到头里面
http.addheader('token', '{token}')
# 登录
http.post('login', 'username=Will4&password=123456')
# 保存userid
http.savejson('userid', 'userid')
# 获取用户信息
http.post('getUserInfo', 'id={userid}')
http.post('logout', None)
Esempio n. 3
0
from inter.interkeys import HTTP
import inspect
from common.Excel import Reader, Writer

http = HTTP(Writer)
#在上两层目录
# 从http这个实例对象里面获取到addheader这个属性或者方法
# func就等价于http.addheader
func = getattr(http, 'addheader')
# 获取参数列表
s = inspect.getfullargspec(func).__str__()
print(s)
s = s[s.find('args=') + 5:s.find(', varargs')]
print(s)
s = eval(s)
print(s)
s.remove('self')
print(s)
Esempio n. 4
0
 def setUpClass(cls) -> None:
     if datadriven.runtype == 'HTTP':
         cls.obj = HTTP(datadriven.writer)
Esempio n. 5
0
from inter.interkeys import HTTP
import inspect

http = HTTP()
# 从http这个实例对象里面获取到addheader这个属性或者方法
# func就等价于http.addheader
func = getattr(http, 'addheader')
# 获取参数列表
s = inspect.getfullargspec(func).__str__()
s = s[s.find('args=') + 5:s.find(', varargs')]
s = eval(s)
s.remove('self')
print(s)
Esempio n. 6
0
from inter.interkeys import HTTP
import inspect

http=HTTP('w')
# 从http这个实例对象里面获取到post这个属性或者方法
# func等价于http.post
func=getattr(http,'post')
# 获取参数列表
s=inspect.getfullargspec(func).__str__()
print(s)
s=s[s.find('args=')+5:s.find(', varargs')]
s=eval(s)
s.remove('self')
print(s)
Esempio n. 7
0
 def setUpClass(cls) -> None:
     #走到这里的时候 调用了get_parmars()替换了type
     if datadriven.runtype == 'HTTP':
         cls.obj = HTTP(datadriven.writer)
Esempio n. 8
0
from inter.interkeys import HTTP

# 创建一个请求库的实例对象
http = HTTP()

http.seturl('http://www.testingedu.com.cn:8081/inter/HTTP/')
http.post('auth', None)
http.savejson('token', 'token')
# 添加token进头域
http.addheader('token', '{token}')
# 2. 登录

# params = {
#     'username': '******',
#     'password': '******'
# }
# http.post('login', params)
http.post('login', 'username=ly02&password=123456')
# 保存userId
http.savejson('userid', 'userId')
# 3.查询用户信息
# http.post('getUserInfo', {'id': http.jsonres['userid']})
http.post('getUserInfo', 'id={userId}')
# 4.退出

http.post('logout', None)