title: How to list all binding variables with GroovyShell
body: <p>I'm very new to Groovy. How can I list all variables I passed to Binding constructor ?</p>
  
  <p>Considering I have following :</p>
  
  <pre><code>@Test
  public void test() {
  
      List&lt;String&gt; outputNames = Arrays.asList("returnValue", "ce");
  
      String script = getScript();
      Script compiledScript = compileScript(script);
      CustomError ce = new CustomError("shit", Arrays.asList(new Long(1)));
  
      Map&lt;String, Object&gt; inputObjects = new HashMap&lt;String, Object&gt;();
      inputObjects.put("input", "Hovada");
      inputObjects.put("error", ce);
  
      Binding binding = new Binding(inputObjects);
      compiledScript.setBinding(binding);
      compiledScript.run();
  
      for (String outputName : outputNames) {
          System.out.format("outputName : %s  =  %s", outputName, binding.getVariable(outputName));
      }
  }
  
  private Script compileScript(String script) {
      GroovyShell groovyShell = new GroovyShell();
      Script compiledScript = groovyShell.parse(script);
      return compiledScript;
  }
  </code></pre>
  
  <p>How can I iterate over all the variables (over the hashMap) in groovy.script ?</p>