Hi nysus,
I know the feeling exactly :-) I think the only good answer is "it depends", so I'd suggest you try to get a broad spectrum of input of how others do it, and gain your own experience.
Here's some of my thoughts about whether parameters should be validated and whether to test that:
- What kind of failure can be expected if the user passes a wrong parameter? E.g. parameters that cause files to be edited or even deleted should probably be checked in detail, but if e.g. it's a value that would cause Perl to issue a warning message or make an incorrect calculation, maybe the user of your code needs to track that issue down on their own.
- Who is the intended audience? How user friendly do you want the code to be?
- How user friendly does the code need to be? Also: after gaining some experience with the API, which parameters do the users get wrong most often?
- What metric are you testing by? For example, even 90-100% code coverage doesn't necessarily require you to fiddle with every argument.
- Personally, I rarely check the content of error messages my code generates. Sometimes, when my code generates a custom warning for example, will I check that it does get generated.
- Consider what you're testing for: If you use e.g. Params::Validate, and that module is well-tested, are your tests just double-checking that it works?
Hope this helps,
-- Hauke D
Update: Minor rewording & reorg. and added the last item to the list.