2

I have a local Jenkins server on my Windows laptop. I have created and configured a job that can only run on Windows since it uses VBScript and a Windows BAT file. Is it possible to create a similar job that can runs on a Jenkins server in Linux using the Wine utility? The VbScript file and BAT file are given below.

VbScript File

OPTION EXPLICIT

Dim RootFolder, ExecFolder, Command, FSO, Shell

Set FSO = CreateObject("Scripting.FileSystemObject")
Set Shell = CreateObject("WScript.Shell")

RootFolder = FSO.GetParentFolderName(FSO.GetParentFolderName(Wscript.ScriptFullName))
ExecFolder = FSO.GetParentFolderName(Wscript.ScriptFullName)

On Error Resume Next

'Clean previous log files
Call FSO.DeleteFile(ExecFolder & "\*.txt", True)
Call FSO.DeleteFile(RootFolder & "\Test\*.txt", True)
Call FSO.DeleteFile(ExecFolder & "\*.log", True)

'Execute
Command = Chr(34) & RootFolder &  "\SoapUI\bin\testrunner.bat" & Chr(34) & " " & Chr(34) & RootFolder & "\Test\Expando.xml" & Chr(34)

Shell.CurrentDirectory = ExecFolder
Call Shell.Run(Command, 1, True)
'WScript.Sleep(20000)
'Shell.SendKeys("~")

testrunner.bat File

@echo off

set SOAPUI_HOME=%~dp0
if exist "%SOAPUI_HOME%..\jre\bin" goto SET_BUNDLED_JAVA

if exist "%JAVA_HOME%" goto SET_SYSTEM_JAVA

echo JAVA_HOME is not set, unexpected results may occur.
echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
goto SET_SYSTEM_JAVA

:SET_BUNDLED_JAVA
set JAVA=%SOAPUI_HOME%..\jre\bin\java
goto END_SETTING_JAVA

:SET_SYSTEM_JAVA
set JAVA=java

:END_SETTING_JAVA


rem init classpath

set CLASSPATH=%SOAPUI_HOME%soapui-5.2.1.jar;%SOAPUI_HOME%..\lib\*
"%JAVA%" -cp "%CLASSPATH%" com.eviware.soapui.tools.JfxrtLocator > %TEMP%\jfxrtpath
set /P JFXRTPATH= < %TEMP%\jfxrtpath
del %TEMP%\jfxrtpath
set CLASSPATH=%CLASSPATH%;%JFXRTPATH%

rem JVM parameters, modify as appropriate
set JAVA_OPTS=-Xms128m -Xmx1024m -Dsoapui.properties=soapui.properties "-Dsoapui.home=%SOAPUI_HOME%\"

if "%SOAPUI_HOME%\" == "" goto START
    set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.libraries="%SOAPUI_HOME%ext"
    set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.listeners="%SOAPUI_HOME%listeners"
    set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.actions="%SOAPUI_HOME%actions"

:START

rem ********* run soapui testcase runner ***********

"%JAVA%" %JAVA_OPTS% com.eviware.soapui.tools.SoapUITestCaseRunner %*
Krash
  • 45
  • 2
  • 8
  • From what I can see, the VBScript file just deletes some files and then runs a batch script, so that is pretty easy to convert. The batch file itself is basically setting up some environment variables to run Java, which will be subtly different on Linux, but still not too tricky. I think you should just convert it all to Bash! – BoffinBrain Aug 23 '17 at 10:02
  • The Jenkins job also uses SOAPUI. Will I have to download the Linux version of SOAPUI as well in order to make it work? – Krash Aug 24 '17 at 00:10
  • Java is cross-platform, so as long as Java is installed correctly on the box that runs Jenkins, and provided that SOAPUI itself is developed in a platform-agnostic manner, you should be fine. – BoffinBrain Aug 24 '17 at 09:29

0 Answers0