Example of Test case based on a Job

Talend Software Development Life Cycle Best Practices Guide

author
Talend Documentation Team
EnrichVersion
6.5
EnrichProdName
Talend Big Data
Talend MDM Platform
Talend Data Integration
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend Data Management Platform
task
Design and Development
Deployment
Administration and Monitoring
EnrichPlatform
Talend Repository Manager
Talend Studio
Talend Administration Center
Talend JobServer
Talend CommandLine
Talend Artifact Repository
A Job called job_load_California_clients is created in a project called ci_project. The Job aims at reading a .csv file containing a list of clients living in California, matching these clients with those coming from the Orange county of Los Angeles using a tMap component, before uploading the result into a MySQL database.

The processing part (tMap) is used to create a Test case called test_process_client_file and will allow developers to test, filter and map any types of input and output files.

Note that the generated skeleton depends on the component(s) selected in the Job to create the Test.

Here, the Test case aims at:
  • reading input data files (tFileInputDelimited components),

  • transforming data with an immutable set of components (INPUT and OUTPUT items) based on the initial Job,

  • writing the output data (to a tFileOutputDelimited component),

  • comparing the temporary output file (tCreateTemporaryFile component) to a reference file you need to define, using a tFileCompare component,

  • generating the Test execution status (OK if it succeeds, Fail if it fails) using a tAssert component.

Note that you can add as many instances of tests as you need, which means you can run the same test with different input and reference files.

The Test Case is ready to be executed once the data set has been defined in the Test Case view, and a specific context group (called Test) has been defined in the Context view. The data set consists of data files that you define as input and reference files to test your data.

The Test Case was successfully executed on the Test Instance and the input and reference files are identical.

Once developers have designed the integration tests locally in the Studio, these tests need to be automated with continuous integration tools such as build systems. For more information, see Executing Tests.