Example #1
0
 private void randomStringCmd(Element elem) {
   String paramName = elem.getAttributeValue("out");
   String size = elem.getAttributeValue("size");
   String prefix = elem.getAttributeValue("prefix");
   String paramValue = TestUtils.createRandomString(prefix, Integer.parseInt(size));
   logger.info("randomStringCmd: paramName=" + paramName + " paramValue=" + paramValue);
   addParam(paramName, paramValue);
 }
  public void runTest() {

    Map<String, Object> map = this.parent.getMap();
    map.put("url", this.urlName);
    try {
      String scriptText = TestUtils.readUrlText(this.urlName);
      Class scriptClass = GroovyUtil.parseClass(scriptText);

      Binding binding = new Binding();
      binding.setVariable("context", map);
      binding.setVariable("seleniumXml", this.parent);
      InvokerHelper.createScript(scriptClass, binding).run();
    } catch (MalformedURLException e) {
      System.out.println("Scriptrunner, runTest, MalformedURLException error: " + e.getMessage());
    } catch (IOException e) {
      System.out.println("Scriptrunner, runTest, IOException error: " + e.getMessage());
    }
  }