djangofan
13 years agoContributor
The first line of testrunner.bat needs to change
I am a SoapUI PRO subscriber. I think it is unfortunate that the first line of "testrunner.bat" is:
For multiple reasons:
1. Because of this, the testrunner uses an invalid SOAPUI_HOME value, which includes the "/bin" directory on the end of the defined variable. Everyone knows that the "/bin" directory should be a subdirectory of the actual SOAPUI_HOME instead of being part of it. Because of this, to reference anything outside of the "bin" directory, you have to use "%SOAPUI_HOME%\..\lib" or similar, which is ugly.
2. Using set SOAPUI_HOME=%CD% would have been better than set SOAPUI_HOME=%~dp0 because the %CD% doesn't have a backslash on the end. Without stripping of the trailing slash, this also makes things ugly because, for example, calling testrunner.bat currently looks like this:
This is also ugly and unfortunate that the script is this way.
3. It is really too bad that the first line doesn't look like this instead because it would allow setting SOAPUI_HOME in a system variable or in a calling script without having to worry about the testrunner.bat script stomping all over the variable value:
To properly determine SOAPUI_HOME, I would use this code snippet:
set SOAPUI_HOME=%~dp0
For multiple reasons:
1. Because of this, the testrunner uses an invalid SOAPUI_HOME value, which includes the "/bin" directory on the end of the defined variable. Everyone knows that the "/bin" directory should be a subdirectory of the actual SOAPUI_HOME instead of being part of it. Because of this, to reference anything outside of the "bin" directory, you have to use "%SOAPUI_HOME%\..\lib" or similar, which is ugly.
2. Using set SOAPUI_HOME=%CD% would have been better than set SOAPUI_HOME=%~dp0 because the %CD% doesn't have a backslash on the end. Without stripping of the trailing slash, this also makes things ugly because, for example, calling testrunner.bat currently looks like this:
CALL "%SOAPUI_HOME%testrunner.bat"instead of the much prettier alternative:
CALL "%SOAPUI_HOME%\bin\testrunner.bat"
This is also ugly and unfortunate that the script is this way.
3. It is really too bad that the first line doesn't look like this instead because it would allow setting SOAPUI_HOME in a system variable or in a calling script without having to worry about the testrunner.bat script stomping all over the variable value:
IF NOT DEFINED SOAPUI_HOME SET "SOAPUI_HOME=%CD%"
To properly determine SOAPUI_HOME, I would use this code snippet:
:: Set SOAPUI_HOME var based on parent folder and
:: make sure it doesn't end with the 'bin' directory or a slash
IF NOT DEFINED SOAPUI_HOME (
SET "SOAPUI_HOME=%CD%"
)
IF "%SOAPUI_HOME:~-1%"=="\" SET "SOAPUI_HOME=%SOAPUI_HOME:~0,-1%"
IF "%SOAPUI_HOME:~-3%"=="bin" SET "SOAPUI_HOME=%SOAPUI_HOME:~0,-3%"
SET "PATH=%PATH%;%SOAPUI_HOME%\bin"