COBOL Unit Testing

COBUnit is a new project I’ve started to scratch another little itch of mine. I’ve been a COBOL programmer since I started over 20 years ago and although I’ve moved on to more modern languages I still get dragged back into the murky world of WORKING-STORAGE SECTIONs and PROCEDURE DIVISIONs. One thing I hate is having to abandon the safety and comfort of my unit tests, so I thought I’d try and get something done about it, hence COBUnit.

Hopefully, I can keep this project alive long enough to produce something useful…

Advertisement

8 Responses to “COBOL Unit Testing”

  1. Leigh Says:

    Hi, How’s it going? I’m interested in ways of testing COBOL programs. This is partly to test those programs, but also as a way of testing non-COBOL routines being called from COBOL. L

    • markhop Says:

      I’ve not made much progress on this unfortunately. I started working on a pre-processor type of idea where you’d write code in an EXEC SQL type style, something like EXEC TEST ASSERT :WS-VAR1 EQUALS 42 END-EXEC. or something similar. But I’ve not managed to progress at all on this idea. I may not get chance to look at this in much detail over the next few weeks but I’m hoping to get back to it some time in May.

  2. Leigh Says:

    I suppose a low-tech way would be with COPY … REPLACING …

    copy “assert”
    replacing
    data-item by ws-var1
    value by 42.

  3. Leigh Says:

    … or

    copy “assert”
    replacing ==expression== by ==ws-var1 = 42==.

    • markhop Says:

      Leigh,

      I had forgotten about COPY .. REPLACING. Don’t use it at all in my current work but it is a brilliant idea. Simple and wouldn’t need any work to port it between compilers.

      I’m trying to put something together now – a website and a few examples – which hopefully may be finished by the end of the week…

  4. Leigh Says:

    I knocked up a few copy files to test the idea. I’ve used then in a test program I’ve been asked to write. I’m looking forward to seeing your versions.

    Regards,
    Leigh

  5. hvaujour Says:

    Hi,

    There is a new initiative about testing in COBOL, you will be able to find more details on google code site: http://code.google.com/p/cobolunit/

  6. metin Says:

    Just stumbled over your blog today. You might be interested to know that we have launched a unit test unit tool some months ago that is especially aimed at testing cobol programs.

    However, it is not a framework, but rather a tool which is designed to allow for unit testing without the need to write programs or scripts. We appreciate any comments. We are currently working on a presentation demonstrating how exactly it is intended to be used. Basically, cobol structures (copybooks) are parsed, then you define the interface to be tested. Finally you enter input data plus test output criteria which decide upon success or failure.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.