環境配置
使用Pipenv進行虛擬環境管理,Pipfile為依賴模塊管理文件。
- 安裝pipenv:brew install pipenv
- 根項目根目錄下執行命令創建虛擬環境: pipenv install
- 在Pycharm中指定項目運行的虛擬環境 :File->Settings->Project:->Project Interpreter
執行用例
- 配置PyCharm的default test runner為pytest
- 打開PyCharm的run/debug configurations窗口,指定運行文件
- pytest.ini文件中指定配置的config文件
addopts = -rsxX --color=yes --env=test --config=folder/xx_config.yaml --alluredir allure-results --json-report
- 運行