• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • A Testing Tip

    June 17, 2009 Ted Holt

    One of the annoyances of maintenance programming is that testing a program change often takes longer–even several times longer–than the process of making the change. One impediment to testing is the inordinate amount of time required to load a test database with the data appropriate for a good test. In the following paragraphs, I share a simple tip that in some situations reduces the effort to establish a good test environment.

    Many shops maintain a separate system (either another computer or a logical partition of the machine that houses their production system) for program testing. This testing system may contain old production data, although for security reasons, it is better that the testing system not contain old production data.

    The test data, whatever its source, is often inadequate for robust testing, for at least two reasons. First, the data in the test database may not contain enough variety or enough invalid data to properly exercise all parts of a program. For example, suppose a program reads an invoice, then must randomly read (i.e., RPG chain) the customer to whom the invoice was sent. In a clean production database, the random read never fails. If the test data is an old copy of a production database, the case of a failed random read may not get tested.

    Second, test database files are often too large to manage. A programmer does not need to sift through a 200-page report to verify that a program works correctly, and shorter run times make quick work.

    For reasons like these, I prefer to test with small database files in a scratch library of my own, then run a final test against the official test database. But building such a database contributes to the long testing time about which I complained in the first paragraph, especially when a program uses more than a few files. If a program uses logical files, you must first copy the physical files, then recreate the logical files, and this is a process that gets messy quickly. Here is a timesaver that has come in handy for me on many occasions.

    When you copy a logical file and specify CRTFILE(*YES), the created file will be a physical file that looks like the logical file. Obviously this only works for single-format logical files. In the following example, logical file MROITEM serves as a pattern for physical file QTEMP/MROITEM.

    CPYF FROMFILE(MROITEM) TOFILE(QTEMP/MROITEM) +
            CRTFILE(*YES)  NBRRCDS(5)
    

    The new physical file contains five records. Use your favorite database utility to edit the new physical file as often as necessary, keying the values you need to get a good test. You don’t have to worry that a logical file points to a wrong file or file member. You won’t worry about select/omit criteria that might keep your test data from being selected. In the case of a join logical file, you won’t have to determine which of the various underlying physical files a field comes from in order to key in the desired data values.

    Once you’ve tested satisfactorily with the dummy physical files, by all means run a test against the regular test database. Hopefully, there will be no surprises and your program changes will be ready for production.



                         Post this story to del.icio.us
                   Post this story to Digg
        Post this story to Slashdot

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Maxava

    Migrate IBM i with Confidence

    Tired of costly and risky migrations? Maxava Migrate Live minimizes disruption with seamless transitions. Upgrading to Power10 or cloud hosted system, Maxava has you covered!

    Learn More

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    New Generation Software:  FREE Query Migration Planning Webinar, June 25, 2 p.m. EST
    Fujitsu PROGRESSION:  RPG to .NET. . . Smart move made simple
    CNX:  Valence is bringing Web 2.0 to System i. Download a FREE 90-day trial

    IT Jungle Store Top Book Picks

    Easy Steps to Internet Programming for AS/400, iSeries, and System i: List Price, $49.95
    The iSeries Express Web Implementer's Guide: List Price, $49.95
    The System i RPG & RPG IV Tutorial and Lab Exercises: List Price, $59.95
    The System i Pocket RPG & RPG IV Guide: List Price, $69.95
    The iSeries Pocket Database Guide: List Price, $59.00
    The iSeries Pocket SQL Guide: List Price, $59.00
    The iSeries Pocket Query Guide: List Price, $49.00
    The iSeries Pocket WebFacing Primer: List Price, $39.00
    Migrating to WebSphere Express for iSeries: List Price, $49.00
    Getting Started With WebSphere Development Studio Client for iSeries: List Price, $89.00
    Getting Started with WebSphere Express for iSeries: List Price, $49.00
    Can the AS/400 Survive IBM?: List Price, $49.00
    Chip Wars: List Price, $29.95

    Elementool Keeps Bugs from Falling Through the Cracks AS/400: Still Kicking After 21 Years

    Leave a Reply Cancel reply

Volume 9, Number 20 -- June 17, 2009
THIS ISSUE SPONSORED BY:

ProData Computer Services
WorksRight Software
CNX

Table of Contents

  • V6R1 Run SQL Scripts: Saving Scripts to a System i Source File
  • A Testing Tip
  • Admin Alert: A Simple Save While Active Backup Program

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Meet The Next Gen Of IBMers Helping To Build IBM i
  • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
  • Will Independent IBM i Clouds Survive PowerVS?
  • Now, IBM Is Jacking Up Hardware Maintenance Prices
  • IBM i PTF Guide, Volume 27, Number 24
  • Big Blue Raises IBM i License Transfer Fees, Other Prices
  • Keep The IBM i Youth Movement Going With More Training, Better Tools
  • Remain Begins Migrating DevOps Tools To VS Code
  • IBM Readies LTO-10 Tape Drives And Libraries
  • IBM i PTF Guide, Volume 27, Number 23

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle