首先,创建一个test_sample/test_demo.py
文件,写入下面三行代码。
def test_bing(page):
page.get("https://www.bing.com")
assert page.get_title == "必应"
不要问题 page
从哪里来,打开终端进入test_sample/
目录,执行pytest
命令。
❯ pytest
================================================= test session starts =================================================
platform win32 -- Python 3.8.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.2.3 (defaults: timer=time.perf_counter disable_g