One Star

Integration/unit testing for Jobs

Hello,
I have a job which have several filters and some error handling.
I would like to have some integration testing on my Jobs.
In fact it is not complicated it reads file in directories, output some result: positive results, error, file generated, etc ?
I have defined a number of test case and I would like compare the test run with expected result.
I did read
http://blog.nanthrax.net/2013/10/talend-esb-continous-integration-part1-using-camel-test-kit/
and
http://blog.nanthrax.net/2013/10/talend-esb-continous-integration-part2-maven-and-commandline/
But could not see a way to do such things with for Jobs ?
Is it possible, do you have some example?
Integration test, unit test is really important in any development environment, what is you advise to tackle such issues.
Best Regards,
Francois
4 REPLIES
Seventeen Stars

Re: Integration/unit testing for Jobs

You could use the exported job in your jUnit tests. A job can be called as command from from OS or you use the libraries and call from the entry class runInTos(String[] contextArgs)
One problem remains, in the Open Source release there is currently no way to build the job outside the studio.
One Star

Re: Integration/unit testing for Jobs

Ok I might be able to call the job from outside, but how I compare the result with some expected result.
I cannot compare the file generated (I generate PDF) but usually (in other development tool) I make Junit tests to call this unit and compare the output (before pdf generation) of this unit using different use cases according the expected result.
I do not want something fancy, only to be able to test parts of my jobs (of course continuous integration would be the ultimate goal)
Seventeen Stars

Re: Integration/unit testing for Jobs

In this case you have to split your job into a job what create a comparable result and a job what creates the PDF file.
One Star

Re: Integration/unit testing for Jobs

Well well, is there a way to get the schema values at run-time from outside?
Or the only way of doing that is to dump in a file and read the content of the file with a Talend Test Job?