Is it possible to pass custom properties value to command prompt?
- 6 years ago
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
import groovy.io.FileType
project = testRunner.testCase.testSuite.project ;
tcase = project.testSuites["TSuiteName"].testCases["TCaseName"] ;
def idValue// Get a project property
def projectProperty = tcase.getPropertyValue( "ID" )
log.info(projectProperty)def fileName = "test.txt"
// Defining a file handler/pointer to handle the file.
def inputFile = new File("C:\\Temp\\"+fileName)inputFile.write(projectProperty)
//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");
proc.waitFor()NOTE: for the batch to picks up the value from text, add this to batch file
Echo OFFset /p Id=<"C:\\Temp\\test.txt"
echo %Id%
echo "This is ID" %Id%