代码:
mport openpyxl
import pytest
from page.env_elements import Elements
from logic.login_tp import Login
def get_excel():
case = openpyxl.load_workbook('C:/Users/57890/Desktop/demo1.xlsx')
sheet = case.active
vlaues = []
for row in sheet:
line = []
for cell in row:
line.append(cell.value)
vlaues.append(line)
print(vlaues)
return vlaues
class Login_test:
@pytest.mark.parametrize('username,password', get_excel())
def test_case01(self, username, password):
action = Login()
action.login_tpshop(username, password)
assert '安全退出' in action.get_text(Elements.SAFEQUIT_BUTTON)
if name == 'main':
pytest.main(['-s'])
结果:
进程已结束,退出代码为 5
空套件