【pytest】(三) pytest运行多个文件

简介: 【pytest】(三) pytest运行多个文件

1.运行多个测试文件


pytest 会运行 test_ 开头 或者 _test 结尾的文件,在当前目录和子目录中


2. 一个类下的多个用例的运行, pytest会找到 test_ 开头的方法


import pytest
class TestClass(object):
  def test_one(self):
    x = "this"
    assert 'h' in x
  def test_two(self):
    x = "hello"
    assert hasattr(x, 'check')


运行一下,-q 是 在安静模式下运行


1268169-20180905222519587-1694810638.png

相关文章
|
9月前
|
测试技术 Python
Pytest简单介绍
Pytest简单介绍
54 0
|
2天前
|
测试技术 Python
pytest中的fixture和conftest.py
pytest中的fixture和conftest.py
|
10月前
|
JSON 测试技术 数据格式
19-pytest-allure-pytest环境搭建
19-pytest-allure-pytest环境搭建
|
10月前
|
测试技术 Python
05-pytest-通过confest.py共享fixture
05-pytest-通过confest.py共享fixture
|
12月前
|
测试技术
pytest conftest.py和fixture的配合使用
pytest conftest.py和fixture的配合使用
|
负载均衡 监控 测试技术
pytest学习和使用20-pytest如何进行分布式测试?(pytest-xdist)
pytest学习和使用20-pytest如何进行分布式测试?(pytest-xdist)
153 0
pytest学习和使用20-pytest如何进行分布式测试?(pytest-xdist)
|
自然语言处理 Java 测试技术
pytest学习和使用21-测试报告插件allure-pytest如何使用?
pytest学习和使用21-测试报告插件allure-pytest如何使用?
124 0
pytest学习和使用21-测试报告插件allure-pytest如何使用?
|
测试技术
pytest学习和使用9-fixture中conftest.py如何使用?
pytest学习和使用9-fixture中conftest.py如何使用?
104 0
pytest学习和使用9-fixture中conftest.py如何使用?
|
Python
pytest学习和使用3-对比unittest和pytest脚本在pycharm中运行的方式
pytest学习和使用3-对比unittest和pytest脚本在pycharm中运行的方式
89 0
pytest学习和使用3-对比unittest和pytest脚本在pycharm中运行的方式