in reply to Mock/Fake network fileshare for my new modules Test Suite

can I have a test (mock) "share" (Windows UNC in this case) that I can "load" with samples of both correct and incorrect standards to run the tests against

If you are on Windows, you can map local directories to other drive letters: net use v: \\localhost\c$\strawberry works just fine, everything at C:\strawberry is now also available at V:\. Use net use v: /delete to remove that mapping.

Note that you also can use an explicit share instead of the automatic share c$.

To test, you would set up two directories, "right" and "wrong", and map and unmap them as needed:

#!/usr/bin/perl use strict; use warnings; # Untested! sub run_tests() { # your job! Maybe just system("prove"); } for my $subdir ("right","wrong") { system("net use t: \\\\localhost\\testsuite\\$subdir"); run_tests(); system("net use t: /delete"); }

how can I "switch" test suite (prove command) to run against a) network share when in office, and b) "mock" share when traveling/at home? Also to switch between production and test DMLs

#!/usr/bin/perl use strict; use warnings; use 5.010; # Untested! sub run_tests() { # your job! } sub where_am_i() { # read $ENV{'WHERE_AM_I'}, ping a server, look up host name, whate +ver works } my $share={ homealone => "\\\\localhost\\testsuite", office => "\\\\develserver\\project42\\testsuite", testserver => "\\\\testingfiler\\somewhere\\tests4proj42", prodserver => "\\\\bigfiler0815\\elsewhere" }->{ where_am_i() } // die "Unknown environment"; for my $subdir ("right","wrong") { system("net use t: $share\\$subdir"); run_tests(); system("net use t: /delete"); }

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)