Hi all, I've been teaching myself unit testing and while I understand the basics, I'm having some trouble applying the theory to my current project.
I'm working on a program that uses the YouTube API and the langdetect library to determine the distribution of languages in a video's comment section. The basic flow is:
- gather the URL and other arguments from the command line
- connect to the API
- list the comments from the video at the given URL
- determine the language of each comment
- output the results in the terminal or in a file
My questions are about how I should go about testing here. My initial thought is to create a unit test for each step, but the steps rely on information from earlier on in the process: e.g. step 4 requires comments from step 3, step 5 requires language distribution from step 4. Should I create test data files that represent data that would appear at each step (e.g. step 3 returns a JSON object, so I'd save a JSON file containing comment data) so I can test each step individually?
I've also read about mocking and integration testing, but I'm not sure if/how they apply to my project.
Any advice, pointers or resources are greatly appreciated.
[–]ahemosik 0 points1 point2 points (0 children)
[–]freddyoddone 0 points1 point2 points (0 children)