在运行时使用jenkins调用变量时出错



如果我在本地执行,它可以使用相同的命令,但如果我在Jenkins Getting below中遇到相同的命令错误。有人能指导我吗。

根据我的理解,这是IF ELSE条件的一个问题。如果我去掉那个条件并执行我的脚本,它就可以正常工作了。对于IF ELSE条件,我们需要遵循一些顺序。如果我把ELSE语句放在If块的旁边,我们会得到不同的错误。我更新了我的代码。M仍然不确定我需要遵循的订单

cd C:tempworkspaceUI-TestingUI_Automation
IF "%Execution_File_Name%" == "Tests" (
pabot --testlevelsplit --processes 6 --ordering order_file.pabotsuitenames  
--variable URL:%URL% --variable project:%Project% --variable 
username:%UserName% --variable password:%Password% --removekeywords WUKS -d 
Results %Execution_File_Name%) ELSE (
robot --variable URL:%URL% --variable 
project:%Project% --variable 
username:%UserName% --variable 
password:%Password% --removekeywords WUKS 
-d Results Tests%Execution_File_Name%)
exit 0

在Jenkins中获取以下错误作为-

>    "Module execution started"
>[ ERROR ] Expected at least 1 argument, got 0.
>Try --help for usage information.
>The filename, directory name, or volume label syntax is incorrect.

更新错误:

[ ERROR ] option --variable requires argument
Try --help for usage information.
The filename, directory name, or volume label syntax is incorrect.
The filename, directory name, or volume label syntax is incorrect.
The filename, directory name, or volume label syntax is incorrect.
'-d' is not recognized as an internal or external command,
operable program or batch file.

问题已重新解决。正如我所说的,只有IF ELSE条件格式的问题。

cd C:tempworkspaceUI-TestingUI_Automation
IF "%Execution_File_Name%" == "Tests" (
pabot --testlevelsplit --processes 6 --ordering order_file.pabotsuitenames --variable URL:%URL% --variable project:%Project% --variable username:%UserName% --variable password:%Password% --removekeywords WUKS -d Results %Execution_File_Name%
) ELSE (
robot --variable URL:%URL% --variable project:%Project% --variable username:%UserName% --variable password:%Password% --removekeywords WUKS -d Results Tests%Execution_File_Name%
)
exit 0

最新更新