I am relatively new to automated testing and although I understand the basics to be able to "do it" I don't know much about what are best practices and why.
Specifically I am trying to figure out the best way to write unit tests for a function that reads a table from a pdf file and returns a data structure (In this case I am using Python and the function returns a pandas DataFrame).
The question I am not sure is that would be a good way to test it ... some of the ideas I can come up with are:
Have a "real life" pdf file exactly lie the ones I the function will be reading in real life. I see a couple of cons to this approach:
The file will be a mix of use cases and so the logic and testing in the unit test will be very complex and mixing basic cases with boundary conditions, etc.
It will be impossible to find a "real world" file that has all the cases that need to be tested so one might end up with more and more files
Have a "fake" pdf file that is a stylised version built specifically to test what needs to be tested.
Some other approach that I can't think of and that does not require storing external files?
What would be good practice for that type of problem? Is creating external files generally accepted and a good thing for unit tests? For unit tests I would be inclined to have "fake" files, is that reasonably good?
Thanks in advance for all yout thoughts!!!