title: Problem with Groovy and variable types
body: <p>I'm trying to get a piece of Groovy code (working with SOAPUI), but am having a problem. </p>
  
  <p>What this code is suppose to do is read in a property file, then set some properties in SOAPUI.  I put this in a Groovy script test step in SOAPUI test case, and each time it is run, I want it to read from a different filename, so I have two additional properties in the test case, cur_request_number and max_request_number.</p>
  
  <p>This code is suppose to increment the cur_request_number each time, and check if it reaches the max_request_number, and if so, set the cur_request_number back to 1.  It kind of works, but only as long as max_request_number is 9 or below.  If it's 10 or above, when it reaches 9 or 10, the cur_request_number++ seems to be incrementing it to a string value, e.g., semi-colon.  </p>
  
  <p>In other words, it's suppose to read (on each cycle):</p>
  
  <pre><code>testprop1.txt
  testprop2.txt
  .
  .
  </code></pre>
  
  <p>The code I'm posting below doesn't actually read the textpropX.txt files yet, but just prints the filenames that it WOULD read, since I'm still debugging.</p>
  
  <p>I'm really new to Groovy, so I'm kind of stuck.  I've tried adding toInteger(), but then I get different problems.</p>
  
  <pre><code>def cur_request_number = testRunner.testCase.getPropertyValue("cur_request_number");
  def max_request_number = testRunner.testCase.getPropertyValue("max_request_number");
  log.info "INITIAL cur_request_number=[" + cur_request_number + "]"
  log.info "INITIAL max_request_number=[" + max_request_number + "]"
  
  cur_request_number++;
  
  log.info "BUMPED cur_request_number=[" + cur_request_number + "]"
  
  if (cur_request_number == max_request_number) {
      log.info "In the IF about to reset cur_request_number to 1";
      cur_request_number = "1";
  }
  
  // set the cur_request_number property (either the incremented one, or "1")
  testRunner.testCase.setPropertyValue("cur_request_number", cur_request_number);
  
  cur_request_filename = "E:/SOAPUI-PROPS/testprops" + cur_request_number.toString() +".txt";
  log.info "READING FROM Request file [" + cur_request_filename + "]"
  
  props = new java.util.Properties ()
  file = new File("E:/SOAPUI-PROPS/testprops.txt")
  if(!file.exists()) {
      log.info "No file found at E:/SOAPUI-PROPS/testprops.txt"
  }
  else {
      log.info "max_request_number=[" + max_request_number + "]"
  
      log.info "In the ELSE, cur_request_number=[" + cur_request_number + "]"
      //testRunner.testCase.setPropertyValue("cur_request_number", cur_request_number);
      log.info "Found E:/SOAPUI-PROPS/testprops.txt"
      fis = new FileInputStream (file)
      props.load (fis)
      requestid = props.getProperty ( "requestid" )
      log.info "requestid = [" + requestid + "]"
      dnstring = props.getProperty ( "dnstring" )
      log.info "dnstring= [" + dnstring + "]"
      testRunner.testCase.setPropertyValue("requestid", requestid);
      context.requestid = requestid;
      log.info "Finished setting 'requestid' property"
      testRunner.testCase.setPropertyValue("dnstring", dnstring);
      context.dnstring = dnstring;
      log.info "Finished setting 'dnstring' property"
  } 
  </code></pre>
  
  <p>If anyone could tell me what I'm doing wrong, I'd really appreciate it.</p>
  
  <p>Thanks,
  Jim</p>