zoukankan      html  css  js  c++  java
  • 用pycharm运行pytest

    安装pytest

    1. 在pycharm中建项目,建文件,文件名字要以test_开头

    2.在文件中插入pytest模块

    import pytest  #引用pytest模块

    3.定义test函数,以及断言

    def test_answer():                        #pytest
    assert 200 == 200 #断言

    def test_answer1(): #pytest
    assert 100 == 200 #断言
    def test_answer2():                        #pytest
    assert [3] == r.json()['ReturnValue'] #断言

    4.设置运行函数

    run-->edit configuration-->运行文件那一栏填写要运行的文件:test_10strip.test_answer,test_10strip.test_answer1,test_10strip.test_answer2

    5.在pycharm选定运行的test函数

    6.查看结果

  • 相关阅读:
    OMNETPP: tictoc
    OMNETPP安装
    Unified SR
    SCM
    DC tunnel
    AIMD
    AQM
    MANAGER POJ1281 C语言
    Pascal Library C语言 UVALive3470
    The 3n + 1 problem C语言 UVA100
  • 原文地址:https://www.cnblogs.com/mghhzAnne/p/7737953.html
Copyright © 2011-2022 走看看