import pytest @pytest.fixture def login(): print("登录操作") username = "xuefeifei" return username class TestDemo: def test_a(self,login): print(f"a name = {login}") #使用login的返回值 def test_b(self): print("b") def test_c(self): print("c")
2023-10-02 18:21:16
import pytest @pytest.fixture def login(): print("登录操作") username = "xuefeifei" return username class TestDemo: def test_a(self,login): print(f"a name = {login}") #使用login的返回值 def test_b(self): print("b") def test_c(self): print("c")