Transact

⌘K
  1. Home
  2. Transact
  3. Developer Documentation
  4. Scripting Resources
  5. Testing Scripts

Testing Scripts

Whenever your Ephesoft project is in development it is strongly encourage to test any custom scripts outside of the Ephesoft application. The benefit of this is that you do not have to wait for a batch to process and development can be much faster. Follow the below steps to test a script in your favorite IDE (Netbeans, Eclipse ect.)

Please do the following steps to test the script:

1) Identify the script that you will be testing, for example in Ephesoft we have a few standard scripts that can be inserted into the Ephesoft workflow. These scrips are ScriptPageProcess, ScriptDocumentAssembler, ScriptExtraction, ScriptAutomatedValidation, ScriptExport. There are a few more but testing these scrips will all be relatively the same.

2) Each Script has a basic shell that has an execute method. Since we are testing these outside of Ephesoft in an Isolated IDE we will need to add a main method. Place this main method just before the execute method with in the script. This main Method will have to be commented out or deleted for the script to run in Ephesoft.

3) We have to write a main method in the file and provide the path for the batch xml file.

         	  public static void main(String args[]){
                 //Define a path to the Batch XML. In this case the BI19_Batch.xml was extracted and placed into a folder that was created call scriptdev
                 String filePath = "C:\Ephesoft\SharedFolders\ephesoft-system-folder\BI19\Scriptdev\BI19_batch.xml";
                 DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
                   try {
                           SAXBuilder sb = new SAXBuilder();
                           Document doc = sb.build(filePath);
                           //Note that the name of the script is being used for the execute
                           ScriptExtraction  se = new ScriptExtraction();
                           se.execute(doc, null, null);
                   } catch (Exception x) {
                   }
   }

4) Run the program in your IDE

5) Assumptions: If we are using any Ephesoft specific classes then we have to add all the jars in the class path present at {ephesoft_home}/WEB-INF/lib/*.*