接口自動化測試)
目錄摘要1. 前后端分離后接口是唯一的契約2. 能發(fā)現(xiàn) UI 測試發(fā)現(xiàn)不了的問題3. 測試左移更早發(fā)現(xiàn)問題4. 自動化后可重復(fù)執(zhí)行回歸測試利器一、接口測試用例設(shè)計---思維導圖?編輯二、本次測試所需要的工具以及環(huán)境1、開發(fā)環(huán)境2、Python 第三方庫3、Python 標準庫4、測試報告工具三、搭建接口測試框架1.測試架構(gòu)2.編寫代碼1封裝工具類封裝日志類? 封裝請求類封裝yaml類2用例編寫登錄接口列表頁接口詳情頁接口用戶認證接口編輯頁接口用戶信息接口執(zhí)行測試用例指定測試用例執(zhí)行順序生成測試報告并分析結(jié)果本次測試的gitee倉庫https://gitee.com/sddsfsdf455/blog_-api_-auto-test摘要接口測試是測試系統(tǒng)各組件之間的接口API是否符合預(yù)期是軟件測試里性價比最高的一層。------比單元測試覆蓋范圍大能測模塊間交互比 UI 測試快且穩(wěn)定不依賴頁面元素1. 前后端分離后接口是唯一的契約現(xiàn)在的系統(tǒng)基本都是前后端分離前端頁面調(diào)用后端接口拿數(shù)據(jù)后端接口返回 JSON 給前端渲染接口就是前后端之間的合同如果接口返回的數(shù)據(jù)格式不對、字段缺失、類型錯誤前端頁面直接崩。接口測試就是提前驗證這個 合同 有沒有履行。2. 能發(fā)現(xiàn) UI 測試發(fā)現(xiàn)不了的問題很多問題在頁面上看不出來但接口層面已經(jīng)暴露了越權(quán)漏洞A 用戶能看 B 用戶的數(shù)據(jù)本次測試參數(shù)校驗缺失傳非法值字符串、特殊字符、空值接口不報錯直接 500數(shù)據(jù)泄露接口返回了不該返回的敏感字段密碼、手機號并發(fā) / 性能問題接口響應(yīng)慢、高并發(fā)下報錯狀態(tài)碼不規(guī)范業(yè)務(wù)失敗也返回 200前端無法判斷這些問題點頁面可能 看起來正常但接口層面已經(jīng)有嚴重隱患3. 測試左移更早發(fā)現(xiàn)問題單元測試開發(fā)寫完函數(shù)就能測接口測試后端接口開發(fā)完、前端頁面還沒寫好就能測UI 測試必須等前端頁面全部開發(fā)完才能測接口測試可以在項目早期就介入不用等頁面做好。越早發(fā)現(xiàn) bug修復(fù)成本越低—— 需求階段改只要 1 小時上線后改可能要幾天。4. 自動化后可重復(fù)執(zhí)行回歸測試利器接口一旦寫好變化頻率比 UI 低得多。以后每次代碼更新、版本發(fā)布跑一遍就知道有沒有把老功能搞壞回歸測試。如果靠人工點頁面測費時費力還容易漏。接口測試是用最低的成本最早、最穩(wěn)定地發(fā)現(xiàn)系統(tǒng)模塊間交互問題的測試手段。 前后端分離的項目里接口是系統(tǒng)的骨架骨架穩(wěn)了頁面才不會出大問題。一、接口測試用例設(shè)計---思維導圖二、本次測試所需要的工具以及環(huán)境1、開發(fā)環(huán)境操作系統(tǒng)Windows編程語言Python 3.10開發(fā)工具PyCharm Community Edition 2022.1.3以及postman虛擬環(huán)境venv項目內(nèi)置用于隔離依賴2、Python 第三方庫pytest測試框架負責收集和運行測試用例requests發(fā)送 HTTP 請求支持 GET、POST 等請求方式PyYAML讀寫 YAML 格式的測試數(shù)據(jù)文件jsonschema對接口返回的 JSON 數(shù)據(jù)進行結(jié)構(gòu)校驗allure-pytest生成 allure 測試結(jié)果數(shù)據(jù)pytest-order控制測試用例的執(zhí)行順序通過 pytest.mark.order 裝飾器實現(xiàn)通過在控制臺輸入pip install ......來導入對應(yīng)的包3、Python 標準庫logging日志記錄os文件路徑與目錄操作time時間格式化用于生成帶日期的日志文件名base64圖片轉(zhuǎn) base64 編碼如需傳圖片參數(shù)4、測試報告工具Java 運行環(huán)境JDKallure 命令行工具的運行依賴需配置 JAVA_HOME 環(huán)境變量allure 命令行工具將測試結(jié)果數(shù)據(jù)轉(zhuǎn)換為可視化的 HTML 報告可通過 scoop install allure 安裝或手動下載后配置 Path 環(huán)境變量三、搭建接口測試框架在虛擬環(huán)境下編寫代碼 避免污染全局環(huán)境1.測試架構(gòu)pytest.ini 的內(nèi)容為addopts -vs --alluredir allure-results2.編寫代碼1封裝工具類封裝日志類import logging import os.path import time class info_filter(logging.Filter): def filter(self, record): return record.levelno logging.INFO class err_filter(logging.Filter): def filter(self, record): return record.levelno logging.ERROR class logger: # 使用類方法 為類新增一個類方法 classmethod def getlog(cls): # 獲取日志記錄器對象 指向Logger 名稱為root cls.my_logger logging.getLogger() # 定義日志級別最低為DEBUG cls.my_logger.setLevel(levellogging.DEBUG) logs 2026-8-27.log 2026-8-27-info.log 2026-8-27-err.log # 創(chuàng)建logs文件夾將日志文件儲存進去 方便查看 LOG_PATH ./logs/ if not os.path.exists(LOG_PATH): os.mkdir(LOG_PATH) now time.strftime(%Y-%m-%d) log_name LOG_PATH now .log info_log_name LOG_PATH now -info.log err_log_name LOG_PATH now -err.log # 創(chuàng)建一個日志文件處理器 將日志信息填入指定文件中 # 創(chuàng)建?個 FileHandler 對象指定?志?件的名稱為 log_name # 這個處理器會將?志信息寫?到指定的?件中 all_handler logging.FileHandler(filenamelog_name, encodingutf-8) info_handler logging.FileHandler(filenameinfo_log_name, encodingutf-8) err_handler logging.FileHandler(filenameerr_log_name, encodingutf-8) # 創(chuàng)建?個?志格式器對象 formatter logging.Formatter( %(asctime)s %(levelname)s [%(name)s] [%(filename)s (%(funcName)s:%(lineno)d)] - %(message)s ) # 將格式器設(shè)置到處理器上 all_handler.setFormatter(formatter) info_handler.setFormatter(formatter) err_handler.setFormatter(formatter) # 設(shè)置文件過濾器 info_handler.addFilter(info_filter()) err_handler.addFilter(err_filter()) # 添加處理器到記錄器當中 # 這樣日志記錄器就會使用處理器處理日志信息 cls.my_logger.addHandler(all_handler) cls.my_logger.addHandler(info_handler) cls.my_logger.addHandler(err_handler) return cls.my_logger自定義 logger 日志封裝類通過getlog類方法完成日志記錄器的統(tǒng)一配置設(shè)置日志級別為 DEBUG自動創(chuàng)建 logs 目錄并按日期生成總?cè)罩?、INFO 日志、ERROR 日志三個文件創(chuàng)建三個 FileHandler 分別寫入對應(yīng)文件配置統(tǒng)一的 Formatter 格式含時間、級別、文件名、函數(shù)名、行號、消息內(nèi)容通過自定義 info_filter 和 err_filter 過濾器實現(xiàn)分級輸出info.log 僅存 INFO 級別、err.log 僅存 ERROR 級別。最終返回配置完成的 logger 實例調(diào)用方直接使用即可無需重復(fù)配置實現(xiàn)日志功能的統(tǒng)一封裝與復(fù)用。設(shè)置日志過濾器 將其放在日志處理器上把對應(yīng)級別的日志放入專門設(shè)置的對應(yīng)的日志文件封裝請求類import requests from utils.logging_utils import logger host http://49.235.61.184:19090/ class Request: log logger.getlog() def get(self, url, **kwargs): self.log.info(準備發(fā)起GET請求urlurl) self.log.info(接口信息{}.format(kwargs)) r requests.get(urlurl, **kwargs) self.log.info(接口響應(yīng)狀態(tài)碼{}.format(r.status_code)) self.log.info(接口的響應(yīng)數(shù)據(jù)是{}.format(r.text)) return r def post(self, url, **kwargs): self.log.info(準備發(fā)起POST請求url url) self.log.info(接口信息{}.format(kwargs)) r requests.post(urlurl, **kwargs) self.log.info(接口響應(yīng)狀態(tài)碼{}.format(r.status_code)) self.log.info(接口的響應(yīng)數(shù)據(jù)是{}.format(r.text)) return r自定義一個 Request 請求類在類內(nèi)封裝 get 和 post 請求方法接收 url 及其他請求參數(shù)。該方法在調(diào)用原生 requests.get/requests.post 發(fā)送請求的前后通過 logging 日志記錄器分別記錄請求信息URL、請求參數(shù)和響應(yīng)信息狀態(tài)碼、響應(yīng)數(shù)據(jù)實現(xiàn)了在不修改原生 requests 方法的前提下為請求過程增加統(tǒng)一的日志記錄功能。日志可同時輸出到控制臺和日志文件便于排查問題。封裝yaml類 使用yaml import os import yaml # 在yaml文件中存儲數(shù)據(jù) def write_yml(filename, data): with open(os.getcwd() /data/ filename, modea, encodingutf-8) as f: yaml.safe_dump(data, streamf) # 在yaml文件中讀取數(shù)據(jù)并返回需要的信息-token登錄憑證 def read_yml(filename, key): with open(os.getcwd() /data/ filename, moder, encodingutf-8) as f: data yaml.safe_load(streamf) return data[key] # 清理yaml中的數(shù)據(jù) def clear_yml(filename): with open(os.getcwd() /data/ filename, modew, encodingutf-8) as f: f.truncate()自定義 YAML 數(shù)據(jù)讀寫工具封裝write_yml、read_yml、clear_yml三個函數(shù)實現(xiàn)測試數(shù)據(jù)的統(tǒng)一管理write_yml以追加模式打開文件通過yaml.safe_dump將接口返回的動態(tài)數(shù)據(jù)如 token、blogId寫入 YAML 文件實現(xiàn)跨用例數(shù)據(jù)傳遞read_yml以只讀模式打開文件通過yaml.safe_load解析內(nèi)容并按 key 返回對應(yīng)數(shù)據(jù)值供測試用例讀取使用clear_yml通過truncate清空文件內(nèi)容用于測試前重置數(shù)據(jù)避免歷史數(shù)據(jù)干擾。三個函數(shù)統(tǒng)一一起使用os.getcwd()拼接 data 目錄路徑實現(xiàn)數(shù)據(jù)與代碼分離便于維護和擴展。2用例編寫登錄接口 登錄-接口自動化測試 url--... 請求數(shù)據(jù)為json格式{userName:zhangsan,password:123456} 利用jsonSchema校驗接口返回數(shù)據(jù) 保存登陸憑證數(shù)據(jù) import re import pytest from jsonschema.validators import validate from utils.request_utils import host, Request from utils.yaml import write_yml pytest.mark.order(1) class TestLogin: url host user/login schema { type: object, additionalProperties: False, properties: { code: { type: number }, errMsg: { type: [null, string] }, data: { type: [object, null], properties: { userId: { type: number }, token: { type: string } }, required: [ userId, token ] } }, required: [ code, errMsg, data ] } pytest.mark.parametrize(login, [ { userName: *****, password: ********, }, { userName: ********, password: ********, } ]) def test_login_success(self, login): json { userName: login[userName], password: login[password] } r Request().post(urlself.url, jsonjson) validate(instancer.json(), schemaself.schema) assert r.json()[code] 200 assert re.match(r\S{100,}, r.json()[data][token]) # 保存用戶的登錄憑證token data { user_token: r.json()[data][token] } write_yml(data.yaml, data) pytest.mark.parametrize(login, [ { userName: *****, password: ***, }, { userName: ********, password: *******, }, { userName: ******, password: ******, }, { userName: , password: ****, }, { userName: ********, password: , }, { userName: , password: , }, { userName: ******, password: *******1111, }, { userName: *********11111111111111111, password: *********, } ]) def test_login_fail(self, login): json { userName: login[userName], password: login[password] } r Request().post(urlself.url, jsonjson) validate(instancer.json(), schemaself.schema) assert r.json()[code] -1 assert r.json()[data] is None定義一個登錄測試類------未登錄狀態(tài)下訪問測試用例登錄狀態(tài)下訪問的測試用例并分為正常測試用例和異常測試用例使用pytest中內(nèi)置的pytest.mark.parametrize裝飾器對測試函數(shù)的參數(shù)進?參數(shù)化。以達到測試多組數(shù)據(jù)的目的獲取到登錄接口的請求數(shù)據(jù)之后 將它寫入yaml文件中并保存起來以便之后調(diào)用所需數(shù)據(jù)JSON Schema?個?來定義和校驗JSON的web規(guī)范簡??之JSON Schema是?來校驗json是否符合預(yù)期。根據(jù)json創(chuàng)建 JSON Schema 后在類中定義一個schema并 將得出的數(shù)據(jù)放入其中validate方法可以將識別得到的數(shù)據(jù)類型和請求的url的請求信息進行匹配驗證請求信息是否出現(xiàn)錯誤如何獲取測試用例的json數(shù)據(jù)1.打開postman 輸入正確的網(wǎng)址以及添加所需的請求數(shù)據(jù)比如復(fù)制整段json數(shù)據(jù) 并且打開https://json.tqji.cn/to-schema這樣就可以獲取相應(yīng)的Schema數(shù)據(jù)了最后使用validate方法將請求到的的網(wǎng)頁數(shù)據(jù)和取得的Schema數(shù)據(jù)比較來驗證數(shù)據(jù)類型是否匹配最后使用assert 進行斷言具體的數(shù)據(jù)內(nèi)容是否符合預(yù)期。列表頁接口import pytest from jsonschema.validators import validate from utils.request_utils import host, Request from utils.yaml import read_yml, write_yml pytest.mark.order(2) class TestList: url host blog/getListByPage Schema { type: object, additionalProperties: False, properties: { code: { type: number }, errMsg: { type: null }, data: { type: object, properties: { total: { type: number }, pages: { type: number }, pageNum: { type: number }, pageSize: { type: number }, records: { type: array, items: { type: object, properties: { id: { type: number }, title: { type: string }, content: { type: string }, createTime: { type: string } }, required: [ id, title, content, createTime ] } } }, required: [ total, pages, pageNum, pageSize, records ] } }, required: [ code, errMsg, data ] } def test_List_No_login(self): r Request().get(urlself.url) assert r.status_code 401 def test_List_login(self): token read_yml(data.yaml, user_token) header { User_token: token } r Request().get(urlself.url, headersheader) validate(instancer.json(), schemaself.Schema) # 獲取列表頁的具體blogID data { blogId: r.json()[data][records][0][id] } write_yml(data.yaml, data)列表接口的測試方式也和登錄接口的測試步驟差不多包括未登錄狀態(tài)下訪問和登錄狀態(tài)下訪問。獲取后續(xù)接口測試所需要的blogId數(shù)據(jù)調(diào)用write_yaml方法將在列表頁接口的數(shù)據(jù)中獲得的blogId存入yaml文件中方便后續(xù)測試詳情頁接口import pytest from jsonschema.validators import validate from utils.request_utils import host, Request from utils.yaml import read_yml class TestDetail: url host blog/getBlogDetail? Schema { type: object, properties: { code: { type: number }, errMsg: { type: [null, string] }, data: { type: [object, null], properties: { id: { type: [number, null] }, title: { type: string }, content: { type: string }, userId: { type: number }, createTime: { type: string } }, required: [ id, title, content, userId, createTime ] } }, required: [ code, errMsg, data ] } # 未登錄狀態(tài)下訪問詳情頁接口 def test_detail_no_login(self): r Request().get(urlself.url blogId str(123333)) assert r.status_code 401 # 登錄狀態(tài)下訪問 def test_detail_login_success(self): BlogId read_yml(data.yaml, blogId) token read_yml(data.yaml, user_token) header { User_token: token } r Request().get(urlself.url blogId str(BlogId), headersheader) validate(instancer.json(), schemaself.Schema) assert r.json()[code] 200 assert r.json()[errMsg] is None pytest.mark.parametrize(blog_id, [ { blogId: 666666, errMsg: Source must not be null }, { blogId: , errMsg: 參數(shù)校驗失敗 }, { blogId: -1, errMsg: Source must not be null }, { blogId: 0, errMsg: Source must not be null }, { blogId: qq1!!!, errMsg: Method parameter blogId: Failed to convert value of type java.lang.String to required type java.lang.Integer; For input string: \qq1!!!\ }, { blogId: 222, errMsg: Source must not be null }, { blogId: 222222222222222222222222222222222222222, errMsg: Method parameter blogId: Failed to convert value of type java.lang.String to required type java.lang.Integer; For input string: \222222222222222222222222222222222222222\ } ]) def test_detail_login_fail(self, blog_id): token read_yml(data.yaml, user_token) header { User_token: token } r Request().get(urlself.url blogId str(blog_id[blogId]), headersheader) validate(instancer.json(), schemaself.Schema) assert r.json()[code] -1 assert r.json()[errMsg] blog_id[errMsg] def test_detail_login_fail_withoutBlogId(self): token read_yml(data.yaml, user_token) header { User_token: token } r Request().get(urlself.url, headersheader) validate(instancer.json(), schemaself.Schema) assert r.json()[code] -1 assert r.json()[errMsg] 參數(shù)校驗失敗測試在未登錄狀態(tài)下訪問 狀態(tài)碼是否為401 正常登錄下的輸入正確測試用例數(shù)據(jù)之后按照接口測試用例中的數(shù)據(jù)輸入異常登錄的不同blogId數(shù)據(jù)測試是否符合預(yù)期要注意BlogId是數(shù)字不能將其正常和字符串拼接必須要將其強制轉(zhuǎn)換成字符型在使用pytest.mark.parametrize裝飾器參數(shù)化時可以內(nèi)輸入所需要的具體匹配數(shù)據(jù)來看看使用Request類請求所得的信息是否和期望數(shù)據(jù)一樣這是單獨分出來的一個異常測試用例在缺失關(guān)鍵參數(shù)字段的情況下正常訪問接口所以要將中的url拆分成多個部分以方便按照設(shè)計的測試用例進行測試用戶認證接口import pytest from jsonschema.validators import validate from utils.request_utils import host, Request from utils.yaml import read_yml class Test_getAuthorInfo: url host user/getAuthorInfo? Schema { type: object, properties: { code: { type: number }, errMsg: { type: [null, string] }, data: { type: [object, null], properties: { id: { type: number }, userName: { type: string }, githubUrl: { type: string } }, required: [ id, userName, githubUrl ] } }, required: [ code, errMsg, data ] } # 未登陸下訪問 def test_get_authorInfo_no_login(self): url self.url blogId str(12222) r Request().get(urlurl) assert r.status_code 401 def test_get_authorInfo_login_success(self): BlogId read_yml(data.yaml, blogId) token read_yml(data.yaml, user_token) header { User_token: token } r Request().get(urlself.url blogId str(BlogId), headersheader) validate(instancer.json(), schemaself.Schema) assert r.json()[code] 200 assert r.json()[errMsg] is None pytest.mark.parametrize(blog_id, [ { blogId: 666666, errMsg: blogId 不合法 }, . . . . . ]) def test_get_authorInfo_login_fail(self, blog_id): token read_yml(data.yaml, user_token) header { User_token: token } r Request().get(urlself.url blogId str(blog_id[blogId]), headersheader) validate(instancer.json(), schemaself.Schema) assert r.json()[code] -1 assert r.json()[errMsg] blog_id[errMsg] def test_get_authorInfo_login_fail_withoutBlogId(self): token read_yml(data.yaml, user_token) header { User_token: token } r Request().get(urlself.url, headersheader) validate(instancer.json(), schemaself.Schema) assert r.json()[code] -1 assert r.json()[errMsg] 參數(shù)校驗失敗該接口和詳情頁接口的測試有很大一部分是一樣的因為所需的參數(shù)都為blogId所以 只需按照postman中獲取的json數(shù)據(jù)進行微調(diào) Schema值也需適當調(diào)整。編輯頁接口import pytest from jsonschema.validators import validate from utils.request_utils import host, Request from utils.yaml import read_yml class TestAdd: url host blog/add Schema { type: object, properties: { code: { type: number }, errMsg: { type: [null, string] }, data: { type: [boolean, null] } }, required: [ code, errMsg, data ] } # 未登錄狀態(tài)下訪問 def test_add_no_login(self): r Request().post(urlself.url) assert r.status_code 401 # 登錄狀態(tài)下訪問 pytest.mark.parametrize(add, [ { userId: 3, # 用戶本人自己的Id title: 1111, content: 11111 }, . . . . . . ]) def test_add_login_success(self, add): token read_yml(data.yaml, user_token) header { User_token: token } json { userId: add[userId], title: add[title], content: add[content] } r Request().post(urlself.url, headersheader, jsonjson) validate(instancer.json(), schemaself.Schema) assert r.json()[code] 200 assert r.json()[errMsg] is None assert r.json()[data] is True # 異常用例 pytest.mark.parametrize(add_fail, [ { userId: 3, # 用戶本人自己的Id title: , content: , errMsg: [博客正文不能為空, 標題不能為空] }, . . . . . . ]) def test_add_login_fail(self, add_fail): token read_yml(data.yaml, user_token) header { User_token: token } json { userId: add_fail[userId], title: add_fail[title], content: add_fail[content] } r Request().post(urlself.url, headersheader, jsonjson) validate(instancer.json(), schemaself.Schema) assert r.json()[errMsg] in add_fail[errMsg] assert r.json()[code] -1 assert r.json()[data] is None當postman出現(xiàn)“null或者ture這種Boolean類型的數(shù)據(jù)在判斷時需要使用is來判斷請求網(wǎng)頁的json數(shù)據(jù)是否和對應(yīng)的Schema數(shù)據(jù)匹配“null”對應(yīng)Noneture對應(yīng)“Ture”。用戶信息接口import pytest from jsonschema.validators import validate from utils.request_utils import host, Request from utils.yaml import read_yml class Test_UserInfo: url host user/getUserInfo? Schema { type: object, properties: { code: { type: number }, errMsg: { type: [null, string] }, data: { type: [object, null], properties: { id: { type: number }, userName: { type: string }, githubUrl: { type: string } }, required: [ id, userName, githubUrl ] } }, required: [ code, errMsg, data ] } # 未登陸下訪問 def test_get_authorInfo_no_login(self): url self.url userId str(12222) r Request().get(urlurl) assert r.status_code 401 def test_get_authorInfo_login_success(self): token read_yml(data.yaml, user_token) header { User_token: token } r Request().get(urlself.url userId str(3), headersheader) validate(instancer.json(), schemaself.Schema) assert r.json()[code] 200 assert r.json()[errMsg] is None pytest.mark.parametrize(user_id, [ { blogId: 666666, errMsg: Source must not be null }, . . . . . . ]) def test_get_authorInfo_login_fail(self, user_id): token read_yml(data.yaml, user_token) header { User_token: token } r Request().get(urlself.url userId str(user_id[blogId]), headersheader) validate(instancer.json(), schemaself.Schema) assert r.json()[code] -1 assert r.json()[errMsg] user_id[errMsg] def test_get_authorInfo_login_fail_withoutBlogId(self): token read_yml(data.yaml, user_token) header { User_token: token } r Request().get(urlself.url, headersheader) validate(instancer.json(), schemaself.Schema) assert r.json()[code] -1 assert r.json()[errMsg] 參數(shù)校驗失敗執(zhí)行測試用例指定測試用例執(zhí)行順序如果用例的測試順序不是我們想要的我們可以下載這個插件在測試類之前或者測試方法之前添加對應(yīng)的代碼即可按照指定順序執(zhí)行測試用例這里我們所必須要的是登陸憑證和所需的列表頁中的blogId所以我們優(yōu)先執(zhí)行這兩個接口測試用例。生成測試報告并分析結(jié)果我們需要下載Windows版Allure報告 下載地址https://github.com/allure-framework/allure2/releases/download/2.30.0/allure- 2.30.0.zip下載完成之后并解壓之后需要將allure-2.30.0對應(yīng)bin?錄添加到系統(tǒng)環(huán)境變量中添加好之后重新打開pycharm我們需要在兩個地方進行驗證是否安裝成功一個是cmd 一個是py控制臺如果顯示結(jié)果按照上面一樣則說明下載成功接著輸入上述指令 讀取allure-results目錄里的測試結(jié)果數(shù)據(jù)生成 HTML 報告輸出到allure-reports目錄。打開這個文件指定瀏覽器來查看本地報告測試執(zhí)?時間從22:01:24持續(xù)到22:01:33總共耗時 8 秒 899 毫秒。測試時間與測試?例數(shù)量成正比?例數(shù)量越多測試時間越?。餅圖顯?了測試的通過率為 100%這意味著所有 55個測試?例都成功執(zhí)?沒有失敗的測試?例。這里可以查看所有執(zhí)行過的測試用例的詳細信息 以及執(zhí)行所需的時間。