Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi!

I finally convinced myself to write some test for an app I'm currently developing (or rather starting to develop). It's a run-of-the-mill webbased DB-thing, using mod_perl, TT, Class::DBI as it's main components.

I know basic testing stuff, but there's one thing I haven't got a decent solution for, which is why I'm seeking help here.

I want to test DB operations etc, i.e. create some entries, update, delete them, etc. Now, my problem is that all this testing interfers with the 'real' data if I run the tests against the 'real' database.

My first idea was to have a second DB to be used during testing. The problem is that to use the other DB, I have to intersperse my production code with snippets like $db="dbi:mysql:test_db" if $ENV{'test'} or likewise. Which seems not to elegant to me...

Another idea was to have testing DBs on the dev-boxes and the 'proper' DB on the production box. But this way I couldn't run the test suite on the production box, which seems not perfect, either.

So, has anybody got some ideas / pointers on how to solve this kind of testing problems?

-- #!/usr/bin/perl for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

In reply to Testing & Databases by domm

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-19 01:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found