被這個問題搞了半天,後來才發現是因爲selenium導出的py文件沒有加main主函數
main函數代碼:
if __name__ == '__main__':
pytest.main()
另外使用pytest框架要注意:
①.py 測試文件必須以 test_ 開頭(或者以 _test 結尾)
②測試類必須以 Test 開頭,並且不能有 init 方法
③測試方法必須以 test_開頭
④斷言必須使用 assert
被這個問題搞了半天,後來才發現是因爲selenium導出的py文件沒有加main主函數
main函數代碼:
if __name__ == '__main__':
pytest.main()
另外使用pytest框架要注意:
①.py 測試文件必須以 test_ 開頭(或者以 _test 結尾)
②測試類必須以 Test 開頭,並且不能有 init 方法
③測試方法必須以 test_開頭
④斷言必須使用 assert