zoukankan      html  css  js  c++  java
  • PyCharm中设置以pytest方式去运行用例

    PyCharm中设置以pytest方式去运行用例

    今天整理项目使用unittest+pytest集成allure生成测试报告,运行出现了错误,通过看日志发现原来是用例重复执行了两遍,导致用例之间出现问题。上网查资料发现是我运行项目的时候操作问题。

    刚开始我运行项目的时候直接在run_test.py文件中右击,Run 'run_test',这种运行方式运行使用pytest运行用例的方式是不正确的,不建议使用。

    正确方式是设置run_test.py文件以pytest方式去运行用例

    1、File ==>> Settings

    2、在输入框中输入:Python Integrated Tools

    3、把里面的 Default test runner 更改为 pytest

    4、右上角选择 Edit Configuration 点击

    5、点击 +,选择Python tests,选择pytest

    6、选择pytes启动文件路径,我的是 run_test.py

    7、选择Python版本

    8、运行的时候,右上角选择 pytest in run_test.py ,然后点击右边的按钮启动即可

    这样设置后,启动的时候就不会出现重复执行用例的问题了。

  • 相关阅读:
    vue axios创建实例
    vue axios全局配置
    vue axios并发请求
    vue axios HTTP 库
    vuex actions异步操作
    vuex getters
    Go并发控制--Channel篇
    UVA10228 A Star not a Tree?
    P1395 会议
    P1337 [JSOI2004]平衡点 / 吊打XXX
  • 原文地址:https://www.cnblogs.com/desireyang/p/12720273.html
Copyright © 2011-2022 走看看