国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

【Python+requests+unittest+excel】實(shí)現(xiàn)接口自動(dòng)化測(cè)試框架

這篇具有很好參考價(jià)值的文章主要介紹了【Python+requests+unittest+excel】實(shí)現(xiàn)接口自動(dòng)化測(cè)試框架。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

一、框架結(jié)構(gòu):

【Python+requests+unittest+excel】實(shí)現(xiàn)接口自動(dòng)化測(cè)試框架,自動(dòng)化測(cè)試,jenkins,單元測(cè)試,自動(dòng)化測(cè)試

?工程目錄

【Python+requests+unittest+excel】實(shí)現(xiàn)接口自動(dòng)化測(cè)試框架,自動(dòng)化測(cè)試,jenkins,單元測(cè)試,自動(dòng)化測(cè)試

二、Case文件設(shè)計(jì)

【Python+requests+unittest+excel】實(shí)現(xiàn)接口自動(dòng)化測(cè)試框架,自動(dòng)化測(cè)試,jenkins,單元測(cè)試,自動(dòng)化測(cè)試

三、基礎(chǔ)包 base

3.1 封裝get/post請(qǐng)求(runmethon.py)

 1 import requests
 2 import json
 3 class RunMethod:
 4     def post_main(self,url,data,header=None):
 5         res = None
 6         if header !=None:    
 7             res = requests.post(url=url,data=data,headers=header)
 8         else:
 9             res = requests.post(url=url,data=data)
10         return res.json()
11 
12     def get_main(self,url,data=None,header=None):
13         res = None
14         if header !=None:    
15             res = requests.get(url=url,data=data,headers=header,verify=False)
16         else:
17             res = requests.get(url=url,data=data,verify=False)
18         return res.json()
19 
20     def run_main(self,method,url,data=None,header=None):
21         res = None
22         if method == 'Post':
23             res = self.post_main(url,data,header)
24         else:
25             res = self.get_main(url,data,header)
26         return json.dumps(res,ensure_ascii=False,sort_keys=True,indent=2)?

3.2 封裝mock(mock.py)

1 from mock import mock
2 #模擬mock 封裝
3 def mock_test(mock_method,request_data,url,method,response_data):
4     mock_method = mock.Mock(return_value=response_data)
5     res = mock_method(url,method,request_data)
6     return res

四、數(shù)據(jù)操作包 operation_data

4.1 獲取excel單元格中的內(nèi)容(get_data.py) ?

4.2?獲取excel中每個(gè)列(data_config.py)

 1 #coding:utf-8
 2 class global_var:
 3     #case_id
 4     Id = '0'
 5     request_name = '1'
 6     url = '2'
 7     run = '3'
 8     request_way = '4'
 9     header = '5'
10     case_depend = '6'
11     data_depend = '7'
12     field_depend = '8'
13     data = '9'
14     expect = '10'
15     result = '11'
16 #獲取caseid
17 def get_id():
18     return global_var.Id
19 
20 #獲取url
21 def get_url():
22     return global_var.url
23 
24 def get_run():
25     return global_var.run
26 
27 def get_run_way():
28     return global_var.request_way
29 
30 def get_header():
31     return global_var.header
32 
33 def get_case_depend():
34     return global_var.case_depend
35 
36 def get_data_depend():
37     return global_var.data_depend
38 
39 def get_field_depend():
40     return global_var.field_depend
41 
42 def get_data():
43     return global_var.data
44 
45 def get_expect():
46     return global_var.expect
47 
48 def get_result():
49     return global_var.result
50 
51 def get_header_value():
52     return global_var.header

4.3?解決數(shù)據(jù)依賴(dependent.py?)

 1 #coding:utf-8
 2 import sys
 3 import json
 4 sys.path.append('C:/Users/lxz/Desktop/InterFace_JIA')
 5 from tool.operation_excel import OperationExcel
 6 from base.runmethod import RunMethod
 7 from operation_data.get_data import GetData
 8 from jsonpath_rw import jsonpath,parse
 9 class DependdentData:
10     def __init__(self,case_id):
11         self.case_id = case_id
12         self.opera_excel = OperationExcel()
13         self.data = GetData()
14 
15     #通過case_id去獲取該case_id的整行數(shù)據(jù)
16     def get_case_line_data(self):
17         rows_data = self.opera_excel.get_rows_data(self.case_id)
18         return rows_data
19 
20     #執(zhí)行依賴測(cè)試,獲取結(jié)果
21     def run_dependent(self):
22         run_method = RunMethod()
23         row_num  = self.opera_excel.get_row_num(self.case_id)
24         request_data = self.data.get_data_for_json(row_num)
25         #header = self.data.is_header(row_num)
26         method = self.data.get_request_method(row_num)
27         url = self.data.get_request_url(row_num)
28         res = run_method.run_main(method,url,request_data)
29         return json.loads(res)
30 
31     #根據(jù)依賴的key去獲取執(zhí)行依賴測(cè)試case的響應(yīng),然后返回
32     def get_data_for_key(self,row):
33         depend_data = self.data.get_depend_key(row)
34         response_data = self.run_dependent()
35         json_exe = parse(depend_data)
36         madle = json_exe.find(response_data)
37         return [math.value for math in madle][0]
38 
39 if __name__ == '__main__':
40     order = {
41         "data": {
42             "_input_charset": "utf-8", 
43             "body": "京東訂單-1710141907182334", 
44             "it_b_pay": "1d", 
45             "notify_url": "http://order.imooc.com/pay/notifyalipay", 
46             "out_trade_no": "1710141907182334", 
47             "partner": "2088002966755334", 
48             "payment_type": "1", 
49             "seller_id": "yangyan01@tcl.com", 
50             "service": "mobile.securitypay.pay", 
51             "sign": "kZBV53KuiUf5HIrVLBCcBpWDg%2FnzO%2BtyEnBqgVYwwBtDU66Xk8VQUTbVOqDjrNymCupkVhlI%2BkFZq1jOr8C554KsZ7Gk7orC9dDbQl                        pr%2BaMmdjO30JBgjqjj4mmM%2Flphy9Xwr0Xrv46uSkDKdlQqLDdGAOP7YwOM2dSLyUQX%2Bo4%3D", 
52             "sign_type": "RSA", 
53             "string": "_input_charset=utf-8&body=京東訂單-1710141907182334&it_b_pay=1d&notify_url=http://order.imooc.com/pay/                          notifyalipay&out_trade_no=1710141907182334&partner=2088002966755334&payment_type=1&seller_id=yangyan01@                          tcl.com&service=mobile.securitypay.pay&subject=京東訂單-1710141907182334&total_fee=299&sign=kZBV53KuiUf5H                          IrVLBCcBpWDg%2FnzO%2BtyEnBqgVYwwBtDU66Xk8VQUTbVOqDjrNymCupkVhlI%2BkFZq1jOr8C554KsZ7Gk7orC9dDbQlpr%2BaMmdjO30                          JBgjqjj4mmM%2Flphy9Xwr0Xrv46uSkDKdlQqLDdGAOP7YwOM2dSLyUQX%2Bo4%3D&sign_type=RSA", 
54             "subject": "京東訂單-1710141907182334", 
55             "total_fee": 299
56             }, 
57             "errorCode": 1000, 
58             "errorDesc": "成功", 
59             "status": 1, 
60             "timestamp": 1507979239100
61         }
62     res = "data.out_trade_no"
63     json_exe = parse(res)
64     madle = json_exe.find(order)
65     print [math.value for math in madle][0]

五、工具類包 tool

5.1 操作excel (operation_excel.py)

 1 #coding:utf-8
 2 import xlrd
 3 from xlutils.copy import copy
 4 class OperationExcel:
 5     def __init__(self,file_name=None,sheet_id=None):
 6         if file_name:
 7             self.file_name = file_name
 8             self.sheet_id = sheet_id    
 9         else:
10             self.file_name = '../dataconfig/case1.xls'
11             self.sheet_id = 0
12         self.data = self.get_data()
13 
14     #獲取sheets的內(nèi)容
15     def get_data(self):
16         data = xlrd.open_workbook(self.file_name)
17         tables = data.sheets()[self.sheet_id]
18         return tables
19 
20     #獲取單元格的行數(shù)
21     def get_lines(self):
22         tables = self.data
23         return tables.nrows
24 
25     #獲取某一個(gè)單元格的內(nèi)容
26     def get_cell_value(self,row,col):
27         return self.data.cell_value(row,col)
28 
29     #寫入數(shù)據(jù)
30     def write_value(self,row,col,value):
31         '''
32         寫入excel數(shù)據(jù)
33         row,col,value
34         '''
35         read_data = xlrd.open_workbook(self.file_name)
36         write_data = copy(read_data)
37         sheet_data = write_data.get_sheet(0)
38         sheet_data.write(row,col,value)
39         write_data.save(self.file_name)
40 
41     #根據(jù)對(duì)應(yīng)的caseid 找到對(duì)應(yīng)行的內(nèi)容
42     def get_rows_data(self,case_id):
43         row_num = self.get_row_num(case_id)
44         rows_data = self.get_row_values(row_num)
45         return rows_data
46 
47     #根據(jù)對(duì)應(yīng)的caseid找到對(duì)應(yīng)的行號(hào)
48     def get_row_num(self,case_id):
49         num = 0
50         clols_data = self.get_cols_data()
51         for col_data in clols_data:
52             if case_id in col_data:
53                 return num
54             num = num+1
55 
56 
57     #根據(jù)行號(hào),找到該行的內(nèi)容
58     def get_row_values(self,row):
59         tables = self.data
60         row_data = tables.row_values(row)
61         return row_data
62 
63     #獲取某一列的內(nèi)容
64     def get_cols_data(self,col_id=None):
65         if col_id != None:
66             cols = self.data.col_values(col_id)
67         else:
68             cols = self.data.col_values(0)
69         return cols
70 
71 
72 if __name__ == '__main__':
73     opers = OperationExcel()
74     print opers.get_cell_value(1,2)

5.2判斷字符串包含,判斷字典是否相等(common_util.py)

 1 #coding:utf-8
 2 import json
 3 class CommonUtil:
 4     def is_contain(self,str_one,str_two):
 5         '''
 6         判斷一個(gè)字符串是否再另外一個(gè)字符串中
 7         str_one:查找的字符串
 8         str_two:被查找的字符串
 9         '''
10         flag = None
11         if isinstance(str_one,unicode):
12             str_one = str_one.encode('unicode-escape').decode('string_escape')
13         return cmp(str_one,str_two)
14         if str_one in str_two:
15             flag = True
16         else:
17             flag = False
18         return flag
19 
20 
21     def is_equal_dict(self,dict_one,dict_two):
22         '''
23         判斷兩個(gè)字典是否相等
24         '''
25         if isinstance(dict_one,str):
26             dict_one = json.loads(dict_one)
27         if isinstance(dict_two,str):
28             dict_two = json.loads(dict_two)
29         return cmp(dict_one,dict_two)

5.3 操作header(operation_herder.py)

 1 #coding:utf-8
 2 import requests
 3 import json
 4 from operation_json import OperetionJson
 5 
 6 
 7 class OperationHeader:
 8 
 9     def __init__(self,response):
10         self.response = json.loads(response)
11 
12     def get_response_url(self):
13         '''
14         獲取登錄返回的token的url
15         '''
16         url = self.response['data']['url'][0]
17         return url
18 
19     def get_cookie(self):
20         '''
21         獲取cookie的jar文件
22         '''
23         url = self.get_response_url()+"&callback=jQuery21008240514814031887_1508666806688&_=1508666806689"
24         cookie = requests.get(url).cookies
25         return cookie
26 
27     def write_cookie(self):
28         cookie = requests.utils.dict_from_cookiejar(self.get_cookie())
29         op_json = OperetionJson()
30         op_json.write_data(cookie)
31         
32 if __name__ == '__main__':
33     
34     url = "http://www.jd.com/passport/user/login"
35     data = {
36         "username":"18513199586",
37         "password":"111111",
38         "verify":"",
39         "referer":"https://www.jd.com"
40     }
41     res = json.dumps(requests.post(url,data).json())
42     op_header = OperationHeader(res)
43     op_header.write_cookie()

5.4 操作json文件(operation_json.py)

 1 #coding:utf-8
 2 import json
 3 class OperetionJson:
 4 
 5     def __init__(self,file_path=None):
 6         if file_path  == None:
 7             self.file_path = '../dataconfig/user.json'
 8         else:
 9             self.file_path = file_path
10         self.data = self.read_data()
11 
12     #讀取json文件
13     def read_data(self):
14         with open(self.file_path) as fp:
15             data = json.load(fp)
16             return data
17 
18     #根據(jù)關(guān)鍵字獲取數(shù)據(jù)
19     def get_data(self,id):
20         print type(self.data)
21         return self.data[id]
22 
23     #寫json
24     def write_data(self,data):
25         with open('../dataconfig/cookie.json','w') as fp:
26             fp.write(json.dumps(data))
27 
28 
29 
30 if __name__ == '__main__':
31     opjson = OperetionJson()
32     print opjson.get_data('shop')

5.5 操作數(shù)據(jù)庫(connect_db.py)

 1 #coding:utf-8
 2 import MySQLdb.cursors
 3 import json
 4 class OperationMysql:
 5     def __init__(self):
 6         self.conn = MySQLdb.connect(
 7             host='localhost',
 8             port=3306,
 9             user='root',
10             passwd='123456',
11             db='le_study',
12             charset='utf8',
13             cursorclass=MySQLdb.cursors.DictCursor
14             )
15         self.cur = self.conn.cursor()
16 
17     #查詢一條數(shù)據(jù)
18     def search_one(self,sql):
19         self.cur.execute(sql)
20         result = self.cur.fetchone()
21         result = json.dumps(result)
22         return result
23 
24 if __name__ == '__main__':
25     op_mysql = OperationMysql()
26     res = op_mysql.search_one("select * from web_user where Name='ailiailan'")
27     print res

5.6 發(fā)送報(bào)告郵件(send_email.py)

 1 #coding:utf-8
 2 import smtplib
 3 from email.mime.text import MIMEText
 4 class SendEmail:
 5     global send_user
 6     global email_host
 7     global password
 8     email_host = "smtp.163.com"
 9     send_user = "jiaxiaonan666@163.com"
10     password = "jia_668"
11     def send_mail(self,user_list,sub,content):
12         user = "jiaxiaonan"+"<"+send_user+">"
13         message = MIMEText(content,_subtype='plain',_charset='utf-8')
14         message['Subject'] = sub
15         message['From'] = user
16         message['To'] = ";".join(user_list)
17         server = smtplib.SMTP()
18         server.connect(email_host)
19         server.login(send_user,password)
20         server.sendmail(user,user_list,message.as_string())
21         server.close()
22 
23     def send_main(self,pass_list,fail_list):
24         pass_num = float(len(pass_list))
25         fail_num = float(len(fail_list))
26         count_num = pass_num+fail_num
27         #90%
28         pass_result = "%.2f%%" %(pass_num/count_num*100)
29         fail_result = "%.2f%%" %(fail_num/count_num*100)
30 
31 
32         user_list = ['609037724@qq.com']
33         sub = "接口自動(dòng)化測(cè)試報(bào)告"
34         content = "此次一共運(yùn)行接口個(gè)數(shù)為%s個(gè),通過個(gè)數(shù)為%s個(gè),失敗個(gè)數(shù)為%s,通過率為%s,失敗率為%s" %(count_num,pass_num,fail_num,pass_result,fail_result )
35         self.send_mail(user_list,sub,content)
36 
37 if __name__ == '__main__':
38     sen = SendEmail()
39     sen.send_main([1,2,3,4],[2,3,4,5,6,7])

六、主函數(shù)

run_test.py

 1 #coding:utf-8
 2 import sys
 3 sys.path.append("C:/Users/lxz/Desktop/InterFace_JIA")
 4 from base.runmethod import RunMethod
 5 from operation_data.get_data import GetData
 6 from tool.common_util import CommonUtil
 7 from operation_data.dependent_data import DependdentData
 8 from tool.send_email import SendEmail
 9 from tool.operation_header import OperationHeader
10 from tool.operation_json import OperetionJson
11 class RunTest:
12     def __init__(self):
13         self.run_method = RunMethod()
14         self.data = GetData()
15         self.com_util = CommonUtil()
16         self.send_mai = SendEmail()
17 
18     #程序執(zhí)行的
19     def go_on_run(self):
20         res = None
21         pass_count = []
22         fail_count = []
23         #10  0,1,2,3
24         rows_count = self.data.get_case_lines()
25         for i in range(1,rows_count):
26             is_run = self.data.get_is_run(i)
27             if is_run:
28                 url = self.data.get_request_url(i)
29                 method = self.data.get_request_method(i)
30                 request_data = self.data.get_data_for_json(i)
31                 expect = self.data.get_expcet_data_for_mysql(i)
32                 header = self.data.is_header(i)
33                 depend_case = self.data.is_depend(i)
34                 if depend_case != None:
35                     self.depend_data = DependdentData(depend_case)
36                     #獲取的依賴響應(yīng)數(shù)據(jù)
37                     depend_response_data = self.depend_data.get_data_for_key(i)
38                     #獲取依賴的key
39                     depend_key = self.data.get_depend_field(i)
40                     request_data[depend_key] = depend_response_data
41                 if header == 'write':
42                     res = self.run_method.run_main(method,url,request_data)
43                     op_header = OperationHeader(res)
44                     op_header.write_cookie()
45 
46                 elif header == 'yes':
47                     op_json = OperetionJson('../dataconfig/cookie.json')
48                     cookie = op_json.get_data('apsid')
49                     cookies = {
50                         'apsid':cookie
51                     }
52                     res = self.run_method.run_main(method,url,request_data,cookies)
53                 else:
54                     res = self.run_method.run_main(method,url,request_data)
55 
56                 if self.com_util.is_equal_dict(expect,res) == 0:
57                     self.data.write_result(i,'pass')
58                     pass_count.append(i)
59                 else:
60                     self.data.write_result(i,res)
61                     fail_count.append(i)
62         self.send_mai.send_main(pass_count,fail_count)
63 
64     #將執(zhí)行判斷封裝
65     #def get_cookie_run(self,header):
66 
67 
68 if __name__ == '__main__':
69     run = RunTest()
70     run.go_on_run()

B站2023年最詳細(xì)的python自動(dòng)化測(cè)試全棧測(cè)試開發(fā)技術(shù)入門到精通教程文章來源地址http://www.zghlxwxcb.cn/news/detail-616601.html

到了這里,關(guān)于【Python+requests+unittest+excel】實(shí)現(xiàn)接口自動(dòng)化測(cè)試框架的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Python+Requests實(shí)現(xiàn)接口自動(dòng)化測(cè)試

    Python+Requests實(shí)現(xiàn)接口自動(dòng)化測(cè)試

    一般對(duì)于自動(dòng)化的理解,有兩種方式的自動(dòng)化。 第一,不需要寫代碼,完全由工具實(shí)現(xiàn),這種方式的工具一般是公司自己研發(fā)的,方便黑盒測(cè)試人員使用。這種工具的特點(diǎn)是學(xué)習(xí)成本低,方便使用,但是通用性不強(qiáng),也就是換了一家公司,就很有可能無法使用之前的工具。

    2024年01月16日
    瀏覽(22)
  • python+requests接口自動(dòng)化框架的實(shí)現(xiàn)

    python+requests接口自動(dòng)化框架的實(shí)現(xiàn)

    為什么要做接口自動(dòng)化框架 1、業(yè)務(wù)與配置的分離 2、數(shù)據(jù)與程序的分離;數(shù)據(jù)的變更不影響程序 3、有日志功能,實(shí)現(xiàn)無人值守 4、自動(dòng)發(fā)送測(cè)試報(bào)告 5、不懂編程的測(cè)試人員也可以進(jìn)行測(cè)試 正常接口測(cè)試的流程是什么? 確定接口測(cè)試使用的工具-----配置需要的接口參數(shù)----

    2024年03月13日
    瀏覽(28)
  • Python接口自動(dòng)化之unittest單元測(cè)試

    Python接口自動(dòng)化之unittest單元測(cè)試

    以下主要介紹unittest特性、運(yùn)行流程及實(shí)際案例。 一、單元測(cè)試三連問 1、 什么是單元測(cè)試? ? 按照階段來分,一般就是單元測(cè)試,集成測(cè)試,系統(tǒng)測(cè)試,驗(yàn)收測(cè)試。單元測(cè)試是對(duì) 單個(gè)模塊 、 單個(gè)類 或者 單個(gè)函數(shù) 進(jìn)行測(cè)試。 將訪問接口的過程封裝在函數(shù)里面; 接口測(cè)試就

    2024年02月07日
    瀏覽(22)
  • Python+Requests+Pytest+YAML+Allure實(shí)現(xiàn)接口自動(dòng)化

    Python+Requests+Pytest+YAML+Allure實(shí)現(xiàn)接口自動(dòng)化

    本項(xiàng)目實(shí)現(xiàn)接口自動(dòng)化的技術(shù)選型:Python+Requests+Pytest+YAML+Allure ,主要是針對(duì)之前開發(fā)的一個(gè)接口項(xiàng)目來進(jìn)行學(xué)習(xí),通過 Python+Requests 來發(fā)送和處理HTTP協(xié)議的請(qǐng)求接口,使用 Pytest 作為測(cè)試執(zhí)行器,使用 YAML 來管理測(cè)試數(shù)據(jù),使用 Allure 來生成測(cè)試報(bào)告 本項(xiàng)目在實(shí)現(xiàn)過程中,把

    2024年02月11日
    瀏覽(790)
  • python接口自動(dòng)化測(cè)試 —— unittest框架suite、runner詳細(xì)使用

    python接口自動(dòng)化測(cè)試 —— unittest框架suite、runner詳細(xì)使用

    測(cè)試套件,理解成測(cè)試用例集 一系列的測(cè)試用例,或測(cè)試套件,理解成測(cè)試用例的集合和測(cè)試套件的集合 當(dāng)運(yùn)行測(cè)試套件時(shí),則運(yùn)行里面添加的所有測(cè)試用例 測(cè)試運(yùn)行器 用于執(zhí)行和輸出結(jié)果的組件 使用測(cè)試套件時(shí),測(cè)試用例的執(zhí)行順序可以自定義,按照添加的順序執(zhí)行 有

    2024年03月16日
    瀏覽(27)
  • pytest+requests+Python3.7+yaml+Allure+Jenkins+docker實(shí)現(xiàn)接口自動(dòng)化

    pytest+requests+Python3.7+yaml+Allure+Jenkins+docker實(shí)現(xiàn)接口自動(dòng)化

    目錄 接口自動(dòng)化測(cè)試框架(用例自動(dòng)生成) 項(xiàng)目說明 技術(shù)棧 環(huán)境部署 框架流程圖與目錄結(jié)構(gòu)圖及相關(guān)說明 1、框架流程圖如下 2、代碼目錄結(jié)構(gòu)圖如下 關(guān)聯(lián)詳解 函數(shù)助手詳解 代碼設(shè)計(jì)與功能說明 1、定義運(yùn)行配置文件 runConfig.yml 2、接口配置文件 apiConfig.ini 3、測(cè)試用例的設(shè)

    2024年02月09日
    瀏覽(699)
  • Python 接口自動(dòng)化 —— requests框架

    Python內(nèi)置的urllib模塊,也可以用于訪問網(wǎng)絡(luò)資源。但是,它用起來比較麻煩,而且,缺少很多實(shí)用的高級(jí)功能。因此我們使用 requests 模塊進(jìn)行進(jìn)行接口測(cè)試。 requests官方文檔資料地址: http://cn.python-requests.org/zh_CN/latest/ cmd(win+R快捷鍵)輸入: 提示以下信息表示安裝成功。

    2024年02月08日
    瀏覽(23)
  • Python接口自動(dòng)化之request請(qǐng)求封裝

    Python接口自動(dòng)化之request請(qǐng)求封裝

    我們?cè)谧鲎詣?dòng)化測(cè)試的時(shí)候,大家都是希望自己寫的代碼越簡(jiǎn)潔越好,代碼重復(fù)量越少越好。那么,我們可以考慮將request的請(qǐng)求類型(如:Get、Post、Delect請(qǐng)求)都封裝起來。這樣,我們?cè)诰帉懹美臅r(shí)候就可以直接進(jìn)行請(qǐng)求了。 我們先來看一下Get、Post、Delect等請(qǐng)求的源碼,

    2024年02月13日
    瀏覽(22)
  • Python接口自動(dòng)化搭建過程,含request請(qǐng)求封裝

    Python接口自動(dòng)化搭建過程,含request請(qǐng)求封裝

    接口測(cè)試自動(dòng)化好處 顯而易見的好處就是解放雙手??。 可以在短時(shí)間內(nèi)自動(dòng)執(zhí)行大量的測(cè)試用例 通過參數(shù)化和數(shù)據(jù)驅(qū)動(dòng)的方式進(jìn)行測(cè)試數(shù)據(jù)的變化,提高測(cè)試覆蓋范圍 快速反饋測(cè)試執(zhí)行結(jié)果和報(bào)告 支持持續(xù)集成和持續(xù)交付的流程 使用Requests+pytest+allure搭建測(cè)試框架的目的

    2024年02月07日
    瀏覽(31)
  • 接口自動(dòng)化測(cè)試:Python+Pytest+Requests+Allure

    接口自動(dòng)化測(cè)試:Python+Pytest+Requests+Allure

    本項(xiàng)目實(shí)現(xiàn)了對(duì)Daily Cost的接口測(cè)試: Python+Requests 發(fā)送和處理HTTP協(xié)議的請(qǐng)求接口 Pytest 作為測(cè)試執(zhí)行器 YAML 管理測(cè)試數(shù)據(jù) Allure 來生成測(cè)試報(bào)告。 本項(xiàng)目是參考了pytestDemo做了自己的實(shí)現(xiàn)。 項(xiàng)目結(jié)構(gòu) api : 接口封裝層,如封裝HTTP接口為Python接口 commom : 從文件中讀取數(shù)據(jù)等各種

    2024年02月09日
    瀏覽(127)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包