|Think about Loose Coupling|
Interactivity in tests - done correctly?by tirwhan (Abbot)
|on Jan 22, 2009 at 13:03 UTC||Need Help??|
tirwhan has asked for the
wisdom of the Perl Monks concerning the following question:
I'm currently finishing off a module I plan to release on CPAN. It would be beneficial if the test suite included tests against a live server (simulated tests are also included, but not as good as the real thing). For this I need to prompt the user for some information, to see whether he has such a server available and what it's address etc. are.
I gather that putting interactivity into the general test suite is a big no-no (it breaks the automated smoke tests for one), so I've been thinking about how I could do this and come up with the following:
Obviously replacing "MyMod" with the actual name of my module. This will produce
When run without the environment variable set, which should be all right I think.
Are there any problems with this approach? Does the "export" syntax even work on non-*NIX-shells? If not, is there an equivalent (I can test for $^O and adjust the skip message accordingly)? Is there a better way to do this?
Thanks in advance
All dogma is stupid.