3.1 测试函数的命名规则

这里测试函数指的是在一个测试文件中直接写的函数,注意和测试类中的测试方法区分开。

测试函数的默认的命名规则为以test开头的函数。

这里需要格外注意,很多人都是模模糊糊,也许是受其他测试框架的影响,总感觉是test_开头,或者_test结尾的,其实不然,在ytest中,
默认的测试函数的命名规则就是test开头,下面通过几个函数来测试一下(https://gitee.com/redrose2100/pytest-demo/blob/master/ch03/ex_001/test_demo.py)


def test_func1():
    print("test_func1")
    assert 1==1

def testfunc2():
    print("testfunc2"

猜你喜欢

转载自blog.csdn.net/redrose2100/article/details/125229477
3.1