Contributions
Re: run SoapUI from a .bat file in a Java program
This works : Process p = null; File execFile = new File ("C:\\Program Files\\SmartBear\\soapUI-Pro-4.0.1\\bin"); try { p = Runtime.getRuntime().exec( "cmd.exe /C testrunner.bat -s\"RealTimeRatingServiceSoapBinding TestSuite\" -c\"RTR-Rate Revision Request TestSuite\" \"C:\\Documents and Settings\\Hellrid1\\Desktop\\SoapUICmd\\RTR-Test-soapui-project.xml\"", (String[])null, execFile ); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Now I need to make the Main calling routine to wait until the SoapUI process finishes so that I can parse the XML after it is done. I tried: try { p.waitFor(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } but when I do this, the SoapUI process does not start. Thank You Very much!12 years agoPlace ReadyAPI QuestionsReadyAPI Questions4.5KViews0likes0CommentsRe: run SoapUI from a .bat file in a Java program
I needed to add a \\ to the \'s in C:\Documents and Settings\Hellrid1\Desktop\SoapUICmd\RTR-Test-soapui-project.xml\ The modified command is : Runtime.getRuntime().exec( "cmd.exe /C testrunner.bat -s\"RealTimeRatingServiceSoapBinding TestSuite\" -c\"RTR-Rate Revision Request TestSuite\" \"C:\\Documents and Settings\\Hellrid1\\Desktop\\SoapUICmd\\RTR-Test-soapui-project.xml\"", null, "C:\\Program Files\\SmartBear\\soapUI-Pro-4.0.1\\bin" ); After that, I am getting a compiler error message from the Eclipse IDE which says: "The method exec(String, String[], File) in the type Runtime is not applicable for the arguments (String, null, String)"12 years agoPlace ReadyAPI QuestionsReadyAPI Questions4.5KViews0likes0Commentsrun SoapUI from a .bat file in a Java program
I am trying to run SoapUI from a .bat file in a java program. Running the Java program creates XML files in a directory, and then I run the .bat file to create a sub-directory with the responses. I would like to combine these two steps. I've tried several variations, but the Main java code looks like this: public static void main(String[] args) { try { System.out.println("begin test"); Process p = Runtime.getRuntime().exec("cmd /c start \"C:/Documents and Settings/Hellrid1/Desktop/runSoapUi.bat\""); p.waitFor(); System.out.println("end test"); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } I've also tried to run it like this: String[] commands = new String[]{"cd C:\\Program Files\\SmartBear\\soapUI-Pro-4.0.1\\bin"}; // This will test the first command /* and add the following to the command array "cmd.exe /C testrunner.bat" + " -s\"RealTimeRatingServiceSoapBinding TestSuite\" " + "-c\"RTR-Rate Revision Request TestSuite\" " + "\"C:/Documents and Settings/Hellrid1/Desktop/SoapUICmd/RTR-Test-soapui-project.xml", "pause"}; */ Process p = Runtime.getRuntime().exec(commands); but was unsuccessful. The batch file named runSoapUi.bat contains this code to run a SoapUI project named RTR-Test-soapui-project.xml cd C:\Program Files\SmartBear\soapUI-Pro-4.0.1\bin\ cmd.exe /C testrunner.bat -s"RealTimeRatingServiceSoapBinding TestSuite" -c"RTR-Rate Revision Request TestSuite" "C:\Documents and Settings\Hellrid1\Desktop\SoapUICmd\RTR-Test-soapui-project.xml" pause12 years agoPlace ReadyAPI QuestionsReadyAPI Questions6.2KViews0likes5Comments- 13 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.1KViews0likes0Comments
Need to change VM Arguments for Groovy script
I need to change the VM Arguments for a Groovy script to: -Doracle.jdbc.thinLogonCapability=o3 I have a Groovy script that needs to connect to an Oracle Database. The Oracle database is version 10.2.0.1.0, which was released in 2005 and is out of date. It has a bug with regards to logging in. Basically, it can't log in with a password that isn't all upper case, and our companies password policy does not allow for having such passwords. The solution to connect to this database in Java, using Eclipse, is to go to the projects's File -> Properties -> Run/Debug Settings. Select the class that has the Main program, and choose the "Edit" botton. In the "Edit Configuration" menu, choose the "Arguments" tab. In the textbox for "VM Arguments" paste: -Doracle.jdbc.thinLogonCapability=o3 and hit the "OK" Button. I need to be able to change the VM Arguments in the Groovy script to: -Doracle.jdbc.thinLogonCapability=o3 so that I can connect to this database. My connection string in Groovy looks like : def sql = Sql.newInstance("jdbc:oracle:thin:@databasename.companyname.net:1234:SIDNAME", "username", "Password1", "oracle.jdbc.driver.OracleDriver")13 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.9KViews0likes2CommentsRe: get filename from XML request file in directory datasource
That worked! The filename was "OH Row 00001 ID 1811 PRODUCT-2581-3007 Output.xml" I created the "Filename" property in the directory DataSource. In the Groovy script, I right clicked for the “Get Data” option to generate this line of code: def fn = context.expand( '${ DataSource#Filename}' ) Then I split the string to get the value that I needed: String [] fnSplit = fn.split(" "); def id = fnSplit[4]; log.info(id) The only thing This is a very useful feature because I can pass values that are not part of the XML. I was wondering is where is this documented. How is anybody supposed to know that this feature exists? Thank You, Dan H.13 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.5KViews0likes0Commentsget filename from XML request file in directory datasource
I have a DataSource that reads XML files from a directory using a DataSource loop for SoapUI Pro Version 4.0. I also have a Groovy script that writes the XML response to a file in another directory. Currently, it uses a time/date stamp to name each XML Response file. I would like to get the filename for each file that is read from the datasource, and use the input filename to rename the output response XML files, so that I can tell which response file corresponds to which input request file. Also, I want to do this using a Groovy script. Here is a copy of my current Groovy script that uses a time/date stamp to name the files: date = new Date(); dateFormat = new java.text.SimpleDateFormat('MM-dd-yyyy'); dateStamp = dateFormat.format(date); createFolder = new File("c:/Output/Responses " + dateStamp); createFolder.mkdir(); time = new Date(); timeFormat = new java.text.SimpleDateFormat("HH.mm.ss.SS"); timeStamp = timeFormat.format(time); def FileName = new PrintWriter( new FileWriter( "c:/Output/Responses " + dateStamp + "/" + dateStamp + " " + timeStamp + " response.xml.txt" )); def ResponseMessage = testRunner.testCase.testSteps["Test Request"].testRequest.response.contentAsString; def request = testRunner.testCase.getTestStepByName( "Test Request" ); def req = request.getProperty( "Request" ); def resp = request.getProperty( "Response" ); FileName.print( resp.value ); FileName.flush(); FileName.close(); log.info( resp.value);13 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.1KViews0likes3Comments