Pytest簡單的例項介紹

2021-10-11 04:19:45 字數 379 閱讀 8904

引用:

針對以上文章的webui自動化,編寫了對應的login_api介面自動化:

介面的呼叫方法:

利用pytest.mark.parametrize裝飾器可以實現測試用例引數化

生成html報告:

python -m pytest --html=report/add_demo.html 生成報告

利用alluer生成報告:

python -m pytest --alluredir=report 生成報告資料

allure generate allure-report 渲染報告頁面

Pytest使用介紹

之前做介面自動化測試接觸的都是python unittest requests htmltestrunner,現在公司用的是pytest,趁週末的時間先整體熟悉下 一 概述 pytest是乙個非常成熟的全功能的python測試框架,主要特點有以下幾點 二 安裝 1 安裝 pip install py...

pytest框架介紹

一 pytest介紹 pytest是python的一種單元測試框架,與python自帶的unittest測試框架類似,但是比unittest框架使用起來更簡潔,效率更高。它具有如下特點 1.非常容易上手,入門簡單,文件豐富,文件中有很多例項可以參考 2.能夠支援簡單的單元測試和複雜的功能測試 3.支...

Python tkinter例項 簡單介紹

usr bin env python3.3 coding utf 8 import tkinter as tk from tkinter import ttk def sample1 hello title 1,最簡單 root tk.tk root.title 你好,這是tkinter世界 roo...