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". ;-)

In reply to Re: Mock/Fake network fileshare for my new modules Test Suite by afoken
in thread Mock/Fake network fileshare for my new modules Test Suite by Galdor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.