如果你还想从头学起Pytest,可以看看这个系列的文章哦!
https://www.cnblogs.com/poloyy/category/1690628.html
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ =
__Time__ = 2020/4/9 19:32
__Author__ = 小菠萝测试笔记
__Blog__ = https://www.cnblogs.com/poloyy/
"""
import pytest
@pytest.mark.weibo
def test_weibo():
print("测试微博")
@pytest.mark.toutiao
def test_toutiao():
print("测试头条")
@pytest.mark.toutiao
def test_toutiao1():
print("再次测试头条")
@pytest.mark.xinlang
class TestClass:
def test_method(self):
print("测试新浪")
def testnoMark():
print("没有标记测试")
pytest -s -m weibo 08_mark.py
pytest -s -m "not weibo" 08_mark.py
pytest -s -m "toutiao or weibo" 08_mark.py