如何配置jenkins以运行量角器脚本(不使用gitlab)

时间:2019-02-19 06:43:15

标签: protractor jenkins-pipeline

我是protractorjenkins的新手。我正在尝试配置jenkins以运行protractor脚本,但是输出显示如下:

Building in workspace C:\Users\suresh.padmanabhan\eclipse-workspace\ProtractorTutorials\Protractor Tests1
[Protractor Tests1] $ cmd /c call C:\Windows\TEMP\jenkins5988193253698839928.bat

C:\Users\suresh.padmanabhan\eclipse-workspace\ProtractorTutorials\Protractor Tests1>protractor C:/Users/suresh.padmanabhan/eclipse-workspace/ProtractorTutorials/Protractor Tests1/conf.js 
'protractor' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\suresh.padmanabhan\eclipse-workspace\ProtractorTutorials\Protractor Tests1>exit 9009 
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE".

该如何解决?

3 个答案:

答案 0 :(得分:0)

错误a1s1 a1s2 a1s3 a2s1 a3s1 暗示在您的量角器脚本所在的Jenkins从属计算机上未安装分度器,或者安装了分度器,但未将其扩展为'protractor' is not recognized as an internal or external command环境变量。

将以下批处理cmd放入构建步骤:执行Windows Batch,然后尝试。

PATH

答案 1 :(得分:0)

永在正确的道路上。问题是因为它正在运行命令,就像它们在批处理脚本中一样,因此您需要像编写脚本一样编写它们。否则,它将始终在第一个命令之后退出,如您所发布的输出所示。

尝试以下方法:

cd "C:\Users\suresh.padmanabhan\eclipse-workspace\ProtractorTutorials\Protractor Tests1"

call npm install protractor
call .\node_modules\.bin\webdriver-manager update
call .\node_modules\.bin\protractor conf.js

答案 2 :(得分:0)

尝试在全球范围内安装量角器,然后尝试后续步骤。

cd "C:\Users\suresh.padmanabhan\eclipse-workspace\ProtractorTutorials\Protractor Tests1"
npm install -g protractor  
.\node_modules\.bin\webdriver-manager update 
.\node_modules\.bin\protractor conf.js

或者在环境变量中指定量角器的安装路径