03.04 - Engine Components


Scripts are written using a DSL (Domain Specific Language) that provides very basic ways to invoke user-callable part of the TA engine. Those callable parts are known as the Engine Components. They are divided in three categories:

Converters

Those components will help you to modify your resources. Usually a converter will assume one task, being :
  • Modify the content (aka data) of a resource. For example: modify the content of a text file.
  • Modify the wrapper (aka type) of a resource. For example: convert a text file to a SQL batch.
In either case the resulting resource will be a new resource. Both the previous and the new version exist and are available in the Test Context once the operation is done.

Commands

A command will perform an operation against a Target, usually using a resource. For instance, execute an SQL query against a database, send a file to a FTP etc.
If the operation carries some results they will be brought back to the Test context as resources.

Assertions

An assertion is a check ran against resource(s). Sometimes the tested resources carry all the information you need to test, in that case one talk about a unary assertion. On the other hand when you need to compare one resource against another one, one talk about a binary assertion. A successful assertion (i.e. the tested resource(s) match(es) the expected criteria) will let the script continue, a failed assertion will stop the script and report the error.

Common behavior of an Engine Component

As resources are immutable, an engine component will never modify a resource. If any new data/result is produced, it will be brought in as a new resource.

An engine component is identified by its name AND by the type of resources and/or targets it manipulates. For example, considering a command named 'put' and that uses SQL batches against databases, and a second Command also named 'put' that upload files to a FTP. At runtime when the engine reads an instruction, depending on the name of the command and the resource and target combined with it will decide which operation will be ran eventually.

An engine component may take additional resources that will tweak its behavior. Those additional – and mostly optional – resources are called configuration (or parameters). For instance let’s imagine you want to upload multiple files to a ftp (e.g. using the command 'put' above) using the defaults settings associated to the FTP Target, and for one of them you need to override the settings. In this case the “put” command allows you to mention another resource carrying those overridden values, and will use them for this specific case only.