I'm always more than a little leary of testing anything related to financial services with a test flag set unless I'm absolutely sure that the inputs and outputs of my code work as expected. As for real accounts, yikes!

I think it might be a good idea to combine unit testing and mock objects with Roadster001's solution above ( sanitizer -> CC processor). Roadster001 provides a good starting point for breaking down the testing problem into unit tests. Perl has a very rich set of testing modules to get you started on creating both mock objects and test suites.

For the unit testing, you should have at least two test suites. The first would make sure that each and every method of your sanitizer generates the correct sanitized code and handles bad and evil data well. If you are not familiar with taint mode, check the perl docs and consider using it in your application and test suites. The second set of unit tests would make sure that the web requests coming out of your CC processor look exactly as they should (well formed, all fields properly filled in, including the test flag :-), and so on). Again, make sure you have tests that input garbage as well as good data.

Two other hints I find helpful when constructing unit tests are:

As for Perl resources, start by exploring Test::Simple and Test::More if you don't know them already. They provide a great way to compare actual and expected values from your methods. There is also a whole set of objects for simulating interaction with web servers. A search on CPAN for "Test::WWW" might be a good place to start. Putting in "Test Mock" into the CPAN search box should also yield some helpful results.

Best, beth

In reply to Re: Daemon to test credit-card authorization? by ELISHEVA
in thread Daemon to test credit-card authorization? by locked_user sundialsvc4

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.