深圳某公司python接口测试专项岗位笔试面试题

版权声明:就算原创也没事,你们随便转!知识在于分享,不在于什么版权!你把这篇文章所讲的内容掌握就行!不懂的问题,就直接下方评论! https://blog.csdn.net/cyjs1988/article/details/82142075

1. 写出能匹配engine-Video-process-service-worker-5846c9b487-:<>68q9x字符串的正则表达式 (5分)
2. 给一个Linux命令mv设计测试用例,从几个维度设计对应?(5分)
3. 测试用例统计pass数为9,失败数为11,如何在python2.x版本编码求出通过率,保留三位数?(5分)
4. 一下代码打印出什么(5分):
counter = 1 
def doLotsOfStuff():
    global counter
    for i in (1, 2, 3.0): 
        counter += i
doLotsOfStuff()
print(counter)
5. 使用shell命令判断不包含关键字RUNNING跟STATUS的行数。(5分)
6. 如何在linux系统做软连接 硬连接 ,两者有什么区别?(5分)
7. 有一个接口定义POST入参:
{"camera_nfo": {
"camera_id": {"type": "string","description": "必填" },
"device_id": {"type": "int","description": "可选" },
"device_type": {"type": "string","description": "可选" },
"place_code": { "type": "int","description": "可选" },
"place_name": {"type": "string","description": "可选" },
"tollgate_id": {"type": "int", "description": "可选, " },
"tollgate_name": {"type": "string","description": "可选" },
"internal_id": {"type": "int", "description": "必填" }
}}
 
请问怎么针对设计接口测试用例,本文档定义有哪些不明确的地方?(10分)
 
8. 从字符串:
time=2018-08-05T13:10:51Zlevel=infomsg=0resources detected"nodeID=engine-video-process-service-worker-5846c9b487-68q9x source=manager/slave.go:108 取出engine-video-process-service-worker-5846c9b487-68q9x,可使用python、java或者其他语言 (20分)
 
9. 给一个接口返回报文(结构不固定,某些报文会时有时无),再给一个key,用python从返回报文中获取相应的值返回,null也要取出来 (提示:报文中可能存在list,list中有多个dict,key有可能在多个dict中存在)(15分)
10. 给一下函数写一个重试5次的装饰器,让接口请求的requests如果请求失败能重试5次(20分)
import requests
from requests.execptions import ConnectionError
 
@retry(5)

def request_data(url, param=None, **kwargs):
ret = requests.post(url, json=param, **kwargs)
return ret
 
def retry(times):
代码实现装饰器

猜你喜欢

转载自blog.csdn.net/cyjs1988/article/details/82142075