Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi ,
I am very new to Talend and trying to add a basic test case to a Tmap component that basically concatenates the FirstName and LastName from a source file and prints to a tLogRow component.
After creating a new test case, I added the input file and reference file to the default test instance.
However , when attempting to run from the Run view , I get the below error
Seems like the input file and reference file selection is not reflected in the Run View.
Am using Talend Studio 7.3.1 and have an active subscription
Starting job SimpleTest at 12:49 21/12/2020.
[INFO ] 12:49:07 jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest- TalendJob: 'SimpleTest' - Start.
[statistics] connecting to socket on port 3389
[statistics] connected
[INFO ] 12:49:07 jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest- tCreateTemporaryFile_1 - tmp file path : C:\Users\OCL\AppData\Local\Temp\talend_5814805769735994825.tmp.
[ERROR] 12:49:07 jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest- tFileInputDelimited_1 -
[INFO ] 12:49:07 jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest- tFileInputDelimited_1 - Retrieving records from the datasource.
[FATAL] 12:49:07 jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest- tFileCompare_1
java.io.FileNotFoundException:
at java.io.FileInputStream.open0(Native Method) ~[?:1.8.0_202]
at java.io.FileInputStream.open(FileInputStream.java:195) ~[?:1.8.0_202]
at java.io.FileInputStream.<init>(FileInputStream.java:138) ~[?:1.8.0_202]
at java.io.FileInputStream.<init>(FileInputStream.java:93) ~[?:1.8.0_202]
at jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest.tFileCompare_1Process(SimpleTestTest.java:1826) [test-classes/:?]
at jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest.tFileInputDelimited_1Process(SimpleTestTest.java:1666) [test-classes/:?]
at jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest.tCreateTemporaryFile_1Process(SimpleTestTest.java:586) [test-classes/:?]
at jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest.runJobInTOS(SimpleTestTest.java:2593) [test-classes/:?]
at jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest.main(SimpleTestTest.java:2315) [test-classes/:?]
Exception in component tFileCompare_1 (SimpleTest)
java.io.FileNotFoundException:
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest.tFileCompare_1Process(SimpleTestTest.java:1826)
at jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest.tFileInputDelimited_1Process(SimpleTestTest.java:1666)
at jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest.tCreateTemporaryFile_1Process(SimpleTestTest.java:586)
at jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest.runJobInTOS(SimpleTestTest.java:2593)
at jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest.main(SimpleTestTest.java:2315)
[statistics] disconnected
Job SimpleTest ended at 12:49 21/12/2020. [Exit code = 1]
Thanks
John
A quick update, I managed to set the file in the Contexts view and now the test seems to run and shows a files differ message. where can I see the actual differences between expected and actual values ? my reference file matches the expected output but I am unable to figure out what is the mismatch
Starting job SimpleTest at 15:29 21/12/2020.
[INFO ] 15:29:23 jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest- TalendJob: 'SimpleTest' - Start.
[statistics] connecting to socket on port 3770
[statistics] connected
[INFO ] 15:29:23 jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest- tCreateTemporaryFile_1 - tmp file path : C:\Users\OCL\AppData\Local\Temp\talend_345061959544157521.tmp.
[INFO ] 15:29:23 jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest- tFileInputDelimited_1 - Retrieving records from the datasource.
[INFO ] 15:29:23 jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest- tFileInputDelimited_1 - Retrieved records count: 5.
[job SimpleTest] Files differ
[INFO ] 15:29:23 jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest- tFileCompare_1 - Compare result : [job SimpleTest] Files differ.
[statistics] disconnected
[INFO ] 15:29:23 jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest- TalendJob: 'SimpleTest' - Done.
Job SimpleTest ended at 15:29 21/12/2020. [Exit code = 0]
When I run the test , I see this error
java.lang.AssertionError:
Failure=1
tAssert_1:File from reference differs from input
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest.testDefault(SimpleTestTest.java:2508)
log4j:WARN No appenders could be found for logger (jctest.simplejob_0_1.simpletest_0_1.SimpleTestTest).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Hi
tFileCompare compares two files and returns a boolean value to indicates the files differ or are identical' in a global variable, it does not show the actual differences, you have to check it manually or through tool, such as https://www.diffchecker.com/diff.
Regards
Shong
Thanks Shong,
In a test case, where is the actual output saved so I can compare it with my expected file ?
It all seems to happen in-memory
Thanks
John