import pytest
@pytest.fixture(scope="session")
def login():
print("\n输入用户名密码登陆! configtest")
yield
print("退出登陆")



def test_cart(login):
print('用例1,登陆后执行添加购物车功能操作')

def test_search():
print('用例2,不登陆查询功能操作')

def test_pay(login):
print('用例3,登陆后执行支付功能操作

pytest_fixture.py::test_cart
输入用户名密码登陆! configtest
PASSED [ 33%]用例1,登陆后执行添加购物车功能操作

pytest_fixture.py::test_search PASSED [ 66%]用例2,不登陆查询功能操作

pytest_fixture.py::test_pay PASSED [100%]用例3,登陆后执行支付功能操作
退出登陆

相关文章:

  • 2021-06-15
  • 2022-01-28
  • 2022-12-23
  • 2022-12-23
  • 2021-09-19
  • 2021-12-15
  • 2021-04-13
  • 2021-12-16
猜你喜欢
  • 2021-12-01
  • 2021-09-21
  • 2021-11-03
  • 2022-12-23
  • 2021-12-01
  • 2022-02-23
  • 2022-12-23
相关资源
相似解决方案