我在soapui中创建了测试,只有几个步骤是运行某些python文件的常规脚本。通过testrunner运行正常,但我必须以管理员身份运行SoapUI。现在,我尝试从jenkins运行此测试,但是由于相同的问题,该测试失败了。我该如何解决?谢谢
运行python的Groovy脚本
def cmdArray2 = ["python", "C:/Users/example.py"]
def process = new ProcessBuilder(cmdArray2).redirectErrorStream(true).start()
process.inputStream.eachLine {
log.warn(it)
}
process.waitFor()
return process.exitValue()
Jenkins批处理命令
"C:\Program Files\SmartBear\ReadyAPI-2.5.0\bin\testrunner.bat" "-RProject Report" "-EDefault environment" "C:\example\example.xml"
错误
16:56:07,645 WARN [log] ERROR: setUpClass (__main__.example)
16:56:07,645 WARN [log] ----------------------------------------------------------------------
16:56:07,645 WARN [log] Traceback (most recent call last):
16:56:07,645 WARN [log] File "C:/Users/example.py", line 18, in setUpClass
16:56:07,645 WARN [log] self.driver = webdriver.Firefox()
16:56:07,646 WARN [log] File "c:\Program Files\Python36\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 151, in __init__
16:56:07,646 WARN [log] log_path=log_path)
16:56:07,646 WARN [log] File "c:\Program Files\Python36\lib\site-packages\selenium\webdriver\firefox\service.py", line 44, in __init__
16:56:07,646 WARN [log] log_file = open(log_path, "a+") if log_path is not None and log_path != "" else None
16:56:07,646 WARN [log] PermissionError: [Errno 13] Permission denied: 'geckodriver.log'
16:56:07,646 WARN [log]
16:56:07,646 WARN [log] ----------------------------------------------------------------------
16:56:07,646 WARN [log] Ran 0 tests in 0.002s
16:56:07,647 WARN [log]
16:56:07,647 WARN [log] FAILED (errors=1)
答案 0 :(得分:0)
您需要以管理员身份运行BAT文件,您可以进行以下更改
runas /user:Administrator "C:\Program Files\SmartBear\ReadyAPI-2.5.0\bin\testrunner.bat" "-RProject Report" "-EDefault environment" "C:\example\example.xml"