2014-09-11 58 views
1

我运行下面的命令来运行的soapUI测试套件,它工作正常如何使用相对或环境变量在批处理命令

testrunner.bat -s"TestSuite4" "D:\Invesco\JP Groovy Code\ExploreGroovy.xml" 

我ahve也低于命令使用,它是工作的罚款,以及

testrunner.bat -s"TestSuite4" "%USERPROFILE%\ExploreGroovy.xml" 

现在我已经增加了一个管环境变量“EnvP”和它的值id“d:\景顺”,并用下面的命令尝试,但它无法正常工作。

testrunner.bat -s"TestSuite4" "%EnvP%\ExploreGroovy.xml" 

有人能帮助我。我不想给任何驱动器的硬编码路径。如果有人有其他解决方案,请提出建议。

谢谢。

回答

1
  • 开始testrunner.bat(大概explorer.exe?)过程中必须 了解新的变量。您是否尝试过注销并在设置后再次登录 ?
  • 如果是cmd,请尝试使用set | find "EnvP"找到变量。如果不存在,则需要开始新的cmd会话。
0

使用这些命令,你应该看到失败的原因:

@echo "%EnvP%" 
@if not exist "%EnvP%\ExploreGroovy.xml" @echo Ouch! 
@pause 
testrunner.bat -s"TestSuite4" "%EnvP%\ExploreGroovy.xml" 
@pause 
0

我所有了SoapUI项目我已经在同一位置的project.xml文件多蝙蝠脚本运行不同测试套件集合,并且它全部进入您的源代码库。

IF NOT DEFINED SOAPUI_ROOT SET SOAPUI_ROOT=%ProgramFiles%\SmartBear\soapUI-Pro-4.6.4 

REM make certain we are where we _think_ we are 
CD %~dp0 

REM cleanup previous results 
DEL /f /q *.log* 
RMDIR /s /q results 

REM run the tests 
CALL "%SOAPUI_ROOT%\bin\testrunner.bat" -s"Smoke TestSuite" -fresults My-soapui-project.xml 

REM determine if there are failures 
IF errorlevel 0 (
    ECHO All tests passed. 
    PAUSE 
    EXIT 0 
) ELSE (
    ECHO There are failures! 
    PAUSE 
    EXIT 100 
) 
相关问题