These questions are very similar: TDD for batch processing: How to do it? and TDD: how to test file outputs? but I'm still left wondering some things
The app processes files/pdfs. It takes them from one FTP server, processes/reads file content, places them in a destination FTP server, depending on content read.
How can I approach file processing in a TDD way? My formal education on TDD was not the best, so even "obvious" suggestions will help me.
My ideas:
The "success" of my app depends on if it reads/processes a source file properly, and also if it places it in the proper destination. So it makes sense to me to write tests for seeing if a file
- is "read" correctly
- ends up in the right place
I could test on specific dummy files, but does this mean I should always ship these specific files with the code, for the tests to pass? The file's name will be different after being processed, so I'm not sure how to test if it ends up in the right place -- should I eyeball the files and then hardcode expected results into the tests?