|The stupid question is the question not asked|
Writing tests when you don't know what the output should beby nysus (Priest)
|on May 17, 2016 at 19:54 UTC||Need Help??|
nysus has asked for the
wisdom of the Perl Monks concerning the following question:
UPDATE: OK, thanks to everyone who chimed in and helped me get a clearer idea of what's involved with writing tests. Looks like I have my work cut out for me.
So I've decided to dip my toes into writing tests. One of the functions of a module I'll be writing will be to grab the file names from an existing directory.
So I'm already stumped. How do I write a test to ensure that the module is loading the correct files if I don't yet know what the files in the directory will be?
Complicating matters, my module will load data structures from files based on the file names it finds. My module will perform operations on the data. How do I test whether the module is performing these operations correctly? Do I need to create a bunch of dummy data structures that mimic all the different possibilities of what the real data will look like and run the tests with this dummy data? This seems like an awful lot of work and I'm not sure it would really be worth the time.
The short tutorials I've found about testing in Perl use only the most simplistic examples and aren't of much help.
$PM = "Perl Monk's";