On 13 November 2017 at 03:59, James E Keenan <jkee...@pobox.com> wrote: > Is there any code which is considered "best practice" for "skip_all unless I > have an Internet connection"? > > For the first time I want to write a library whose tests will benefit from > connection to an FTP server. If there is some code that I could just drop > in for situations where the test suite is run offline, that would be > helpful. > > Thank you very much. > Jim Keenan
There's a defacto ENV var, which if set, one should do no kind of network activity: NO_NETWORK_TESTING After taking that in consideration, whether you do any subsequent network IO depends on the nature of what you're building. Ideally, you should aim to be maximally capable of testing your library in the absence of a network connection, and have safe-guards in place that determine if the network-environment is satisfactory ( eg: first by checking for the aforementioned ENV var, and then doing basic TCP probes ), and then making the tests execution determinate on that being satisfactory. But if Internet access is a quintessential element of whatever you're designing, then you should try more eagerly to run network tests. At least, that's the recommended flow for "end users" When considering maintainers and AUTOMATED_TESTING, one should be even more eager to execute tests, because for these targets, a spurious test failure is has fewer negative consequences, and you want to actively see any anomalies in the tests. So for the AUTOMATED_TESTING/AUTHOR_TESTING/RELEASE_TESTING targets, one should aim to run network IO tests in all circumstances other than an explicit NO_NETWORK_TESTING circumstance. -- Kent KENTNL - https://metacpan.org/author/KENTNL