Test C API Functions Locally with TestRunner - Aster Execution Engine

Teradata Aster® Developer Guide

Product
Aster Execution Engine
Release Number
7.00.02
Published
July 2017
Language
English (United States)
Last Update
2018-04-13
dita:mapPath
xnl1494366523182.ditamap
dita:ditavalPath
Generic_no_ie_no_tempfilter.ditaval
dita:id
ffu1489104705746
lifecycle
previous
Product Category
Software

Because user defined functions are built to run in an Aster instance, testing them locally requires a test program that can simulate the data and services of the cluster. The SDK provides this in the form of the TestRunner (the actual library path and name is sqlmr-sdk/lib/libsqlmr-testrunner.so).

Detailed reference documentation for TestRunner is provided in the header files in sqlmr-sdk/include/sqlmr/testrunner/c/SimpleTest.h and in the supporting headers TestArgumentClause.h and TestColumnDefinition.h.

TestRunner allows you to write a test that:

  • Runs a user defined function contained in a specified user defined function C executable file (a .so library).
  • Provides test input data to the function, using a data input file you specify.
  • Simulates other user defined function services, such as installed files or temporary storage.
  • Writes the test output to files you specify:

    The completed runtime contract file provides a list of the output columns of your user defined function, and the datatype of each. For example, if you have built the "test" target in the tax_input example, you will see sqlmr-sdk/example/c/udf/tax_input/build/testoutput/contract.out

    The output data file contains the actual output your function produced based on the test input data. For example, (assuming you have built the "test" target), you will see, sqlmr-sdk/example/c/udf/tax_input/build/testoutput/testrun.out

After running the function, the test can then verify the contents of the created output files (for the completed contract and output data).