Test case in Spark Jobs doesn't work with a context variable in tCollectAndCheck

Talend Version       6.x


Additional Versions  
Product Big Data
Component Components
Problem Description

In a Spark Test Case, if tCollectAndCheck uses a context variable (for example, context.reference_file1), then the assertion fails even if the content of the referenced file contains the correct values.


It seems Talend uses the value of the context variable itself (the file name) instead of the file content. Here is an extract of execution output:

tCollectAndCheck_1: the reference data does not match the computed results
New elements: true
Missing: true
==== REFERENCE =====
===== RESULTS ======
Problem root cause

Despite the name, the variable reference_file1 isn't the path to the reference file, but its content. This context variable value is the one you set in the Test Cases tab, not in the Contexts tab. Also, with Spark, test cases can be tested only from the Test Cases tab, not from the Run tab.

Solution or Workaround
  1. To browse to your reference file, navigate to the Test Cases tab, then under NameOfTheTestCase > Default, select the context reference_file1.
  2. Click File Browse. The content will appear in the text area below; you can edit it as necessary.
  3. Right-click the name of the test case, then select Run TestCase.


JIRA ticket number  
Version history
Revision #:
3 of 3
Last update:
‎09-29-2018 12:15 AM
Updated by: