我试图使用jenkins运行脚本,我使用pytest框架编写测试,我尝试配置我的项目我使用选项execute shell并使用此代码:
#!/bin/bash
/Library/Python/2.7/site-packages/virtualenv venv --distribute
. venv/bin/activate
# try to run your script here
/Library/Python/2.7/site-packages/pytest -p no:cacheprovider /Users/sergio/testjenkins/test_google.py
这是我试图运行的脚本:
from selenium import webdriver
class TestGoogleSearchTest:
driver = None
def setup(self):
# Create a new Firefox driver instance
self.driver = webdriver.Firefox(executable_path = '/usr/local/bin/geckodriver')
def teardown(self):
# Close the browser after running the tests
self.driver.quit()
def test_search(self):
# Trigger a Google Search
self.driver.get('http://www.google.com')
searchElement = self.driver.find_element_by_name('q')
searchElement.send_keys('6020 peaks')
searchElement.submit()
我的问题是当我尝试构建项目时收到此错误:
E selenium.common.exceptions.WebDriverException: Message: connection refused
/Users/sergio/.pyenv/versions/3.4.2/lib/python3.4/site-packages/selenium/webdriver/remote/errorhandler.py:194: WebDriverException
========================== 1 error in 106.06 seconds ===========================
Build step 'Execute shell' marked build as failure
Finished: FAILURE
不确定可能是什么问题。
提前致谢