Skip to main content
Kinetic Community

Test Harness v1.0

How to Setup and Use the Test Harness for Kinetic Task

Usage

The Test Harness allows you to test handlers without having to add them to your Kinetic Task install, and creating a task tree. it allows you to define both your test inputs, and what the expected outputs should be. Any logging entries are displayed directly to the screen.

Setting Up the Test Harness

Download

Prerequisites - java 1.5 or greater installed

Note - This test harness should be used to test handlers that will be used with Kinetic Task 1.x.

Note - For the purposes of these instructions, it is assumed that all the directories are copied directly to C:\

  1. Download the Test Harness zip file attached to this article
  2. Extract the zip file, it hast two directories - arslibs & kineticTask
  3. Copy these directories to your system (see note above)
  4. Add the arslibs to your system Path variable
  5. Create a folder for your task handlers (see note above)

Configuring a Task Handler to run with the Test Harness

You do not have to change anything in the init.rb or the node.xml. However, it is normal that these are altered as part of your development and testing. The two files that the test harness will specifically use are in the test directory, simple_input.rb & simple_output.xml.

The task handler should be extracted into the handlers directory to run with the test harness.

The first file – simple_input.rb - sets the environment and parameters that are passed during the test. Here is an example from the Sample Person Retrieve:

 

{
  'info' => {
    'server'   => 'matrix.kineticdata.com',
    'username' => 'Demo',
    'password' => '',
    'port'     => '',
    'prognum'  => '0',
    'authentication' => ''
  },
  'parameters' => {
    #    'search_by'    => 'AR Login',
    #    'search_value' => ''
    #    'search_by'    => 'Entry Id',
    #    'search_value' => ''
    #    'search_by'    => 'Email Address',
    #    'search_value' => ''
    'search_by'    => 'AR Login',
    'search_value' => 'Demo'
  }
}
 
The top portion - info - sets the arsystem connection parameters. The second section - parameters - covers the inputs that would normally be handled from the node on the task tree. Here is the Parameters section from the node.xml:
 
 <parameters>
            <parameter name="search_by" description="search by">&lt;%= @parameters['search_by'] %&gt;</parameter>
            <parameter name="search_value" description="search value">&lt;%= @parameters['search_value'] %&gt;</parameter>
 </parameters>
 
The simple_output.xml is meant to mimic the results section of your init.rb file. If your handler is meant to create or modify a record in your Remedy system, you will need to check for the record in the Remedy system. If the output of the handler doesn't match what is in the simple_output.xml file, it will be displayed. Here is an example:
<results>
    <result name="Entry Id" type="Regexp">.+</result>
    <result name="First Name" type="Regexp">.+</result>
    <result name="Last Name" type="Regexp">.+</result>
    <result name="Employee Number" type="Regexp">.+</result>
    <result name="AR Login" type="Regexp">.+</result>
    <result name="Full Name" type="Regexp">.+</result>
    <result name="Phone" type="Regexp">.+</result>
    <result name="Email Address" type="Regexp">.+</result>
...
</results>
 
The .+ in the results is meant to cover any returned result. It will still report an error if there is no (nil) result.
 

Command to Run the Test harness

 
The test harness is run from the command line. The following is the basic syntax:

java -jar kinetic-task.jar -test-handler=PATH_TO_HANDLER

This assumes that you are running the command from the c:\kineticTask directory.

Assuming you are testing the Sample People Retrieve handler, the full command would look like this:

java -jar kinetic-task.jar -test-handler="C:\handlers\kinetic_sample_people_retrieve_v2"