Is it possible to pass custom properties value to command prompt?
1) I have a TestCaseA that store some value :
2) I need one batch file able to pick up the ID that has been store to SOAPUI Custom Properties.
3) Run the batch file
Reason: The batch file will run the TestCaseA multiple times and in the batch file, there will be some action where the command will store file into C and transfer file.
Question: Is it possible groovy script able to do the same?
Solved! Go to Solution.
I finally made a decision to store the value to a file on C:\temp and batch file picks up the value and run the batch based on that ID
project = testRunner.testCase.testSuite.project ;
tcase = project.testSuites["TSuiteName"].testCases["TCaseName"] ;
// Get a project property
def projectProperty = tcase.getPropertyValue( "ID" )
def fileName = "test.txt"
// Defining a file handler/pointer to handle the file.
def inputFile = new File("C:\\Temp\\"+fileName)
//this will solve your issue if the folder name has space
//on command prompt, use this command to check
//dir /X ~1 c:\
Process proc=Runtime.getRuntime().exec("cmd /c start c:\\PROGRA~2\\test.bat");
NOTE: for the batch to picks up the value from text, add this to batch file
set /p Id=<"C:\\Temp\\test.txt"
echo "This is ID" %Id%