Create Script

Redwood HQ provides you with workspace for creating Java, Groovy, C# and Python automation scripts. There is no limitation on what code you can create as long as it follows the coding standards of language of choice. You can have multiple languages be in a single project and a single test case able to use actions which point to these different languages.

  1. On the Scripts tab, in the Scripts pane, in the folder tree, click the src folder.
  2. (optional) To place the new script in a subfolder inside the src folder:
  3. Create a new folder – on the toolbar, click New, click Folder, and then, in the New Folder dialog box, enter the name for the folder and click OK.Click an existing subfolder.
  4. On the toolbar, click New, click File, and then, in the New Folder dialog box, enter the name for the file and click OK.
  5. In the script editor, type the script and, on the toolbar, click Save All.

The following snippets automate an action which has the string parameter ‘print this’.
The first snippet is created in Java. Note that the name of the file should be the same as the class name, JavaPrintlnExample.java.

import java.util.*;
public class JavaPrintlnExample {
     public static void run(HashMap<String, Object> params) {
          System.out.println(params.get("print this"));
     }
}

The second snippet is a Groovy script:

public class GroovyPrintlnExample {
     public static void run(def params) {
          println(params."print this")
     }
}

Compile/Build Scripts

Before execution, you must compile your scripts. RedwoodHQ includes the Apache Ant builder (build.xml).

  1. On the Scripts tab, on the toolbar, click Build Scripts.
  2. The stack trace appears in the Output pane on the bottom. Error messages include a link to the corresponding line in the script.

All your scripts are aggregated into a JAR file.

Feedback

Thanks for your feedback.

Post your comment on this topic.

Please do not use this for support questions.
For customer support, please contact us here.

Post Comment