<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] # **Pytest測試框架** ## **一、pycharm安裝和環境配置** 1、 安裝配置Python3環境: 2、官方下載pycharm: 下載專業版需要破解https://www.runoob.com/w3cnote/pycharm-windows-install.html 在官網搜索selenium可以查看到相關的包; 3、通常使用pycharm管理Python環境: ![](https://img.kancloud.cn/7b/22/7b2238558bc7393f78511c59f75819d9_554x258.png) 4、Pip --version命令查看pip版本 5、安裝selenium、request、allure、配置pytest ## 二、**pytest測試框架** 1、測試用例的識別與運行: ·測試文件test\_\*.py 、 \*\_test.py ·用例識別Test\*類包含的所有test\_\*的方法(不包含\_\_init\_\_方法) ·不在class中的所有test\_\*方法 ·pytest也可以執行unitest框架寫的測試用例 2、參數化生成測試用例: ![](https://img.kancloud.cn/56/da/56dabc4710d286848eeef92da9e741cf_554x270.png) ## 三、**參數化用例** 1、pytest數據參數化 ![](https://img.kancloud.cn/85/82/8582c11c6d8e2b1e590eced065272153_554x158.png) 2、Yaml的基本使用 Yaml實現list: ![](https://img.kancloud.cn/0a/b5/0ab53716245653a4957234cddc8e4b35_138x139.png) Yaml實現字典: ![](https://img.kancloud.cn/fb/e8/fbe8d2a8e9dcac0e78c16d3bd5ad50fd_151x125.png) Yaml進行嵌套: ![](https://img.kancloud.cn/84/ac/84acb074f7a2b0561b1112710b8a5813_185x153.png) 3、加載yaml文件:\*.yaml PyYMAL安裝 ![](https://img.kancloud.cn/e8/32/e832c3219ce46ebd531d58b8b2decf9d_477x90.png) 打印yaml的內容 ![](https://img.kancloud.cn/d3/7e/d37e093e35b71032c2a6ba3cefda007e_554x37.png) ## 四、**測試報告定制** 1、allure安裝 ![](https://img.kancloud.cn/6a/b7/6ab79805d884e30e169179ad601e4355_554x379.png) 在pycharm中Pip install allure-pytest 2、生成報告:第一部生成測試數據pytest --alluredir=/tmp/my\_allure\_results 第二部轉化成測試報告Allure serve /tmp/my\_allure\_results ![](https://img.kancloud.cn/57/bb/57bbd3d1f22365bf90757b4b3e1e95a0_456x91.png) ![](https://img.kancloud.cn/07/79/0779728517cfb2c77d81eb369554a95e_401x16.png) 3、在報告中注解 ![](https://img.kancloud.cn/e8/bc/e8bc5b3d1381a7040e4d49c5b6073f2d_458x183.png) 4、測試結果增加鏈接 ![](https://img.kancloud.cn/c4/51/c4519a5fed6f6eaa5cde96b98b750dec_507x27.png) 5、設置用例級別 ![](https://img.kancloud.cn/37/5a/375a507b7d77ff61848fa162ac505ea1_525x165.png) 6、添加一個純文本 ![](https://img.kancloud.cn/56/e7/56e7ef6d9ab8963c901e787bdf421e16_554x39.png) 7、添加一個html ![](https://img.kancloud.cn/e4/eb/e4eb0380ca4062bfb5b08c75e998e4b7_553x22.png) 8、添加一個圖片 ![](https://img.kancloud.cn/e6/a0/e6a0ea35b0419bc5708f453f1ce8e503_554x36.png) 9、完整演示 ![](https://img.kancloud.cn/b1/4b/b14bf038276066ca4a6eccfc853a7a03_554x276.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看