Seiden Group
Modern Development & Open Source for IBM i
  • Link to LinkedIn
  • Link to Mail
  • Home
  • Seiden PHP+
    • Seiden PHP+
    • Install & Learn
    • SmartSupport
    • PHP Migrations & Upgrades
    • Success Stories
    • Free PHP Assessment
    • Documentation
    • What’s New (Changelog)
  • IBM i Services
    • Development
    • Training & Mentoring
    • Open Source Setup & Upgrades
    • SSL/TLS Install & Learn
    • Performance
  • Support
    • Open Source & PHP
    • VS Code for i
    • Developer Support
    • Support Success Stories
  • VS Code for i
    • Support
    • Training
    • Code for i Resource Guide
    • Getting Started Videos
    • Code for IBM i Fridays
  • Free Stuff
    • IBM i Strategy & Tips
    • PHP Upgrade Assessment
    • CNX Valence Assessment
    • VS Code for IBM i Resources
    • Code for IBM i Fridays
    • QCachegrind Download
    • PHP Toolkit for IBM i Resources
    • Qshell on i Library
  • Blog
  • About
    • About Our Team
    • About Alan Seiden
    • Speakers & Sessions
    • In the News
  • Contact
  • 201.447.2437
  • Search
  • Menu Menu

Seiden Group Blog

Visual Studio Code, RPG and Code Coverage

July 7, 2021/0 Comments/in RPG, VS Code for i /by Liam Barry Allan

2023 Update

The Code Coverage extension for VS Code for i remains in development
and is unavailable at this time.


This is the second post in my series on RPG and COBOL development using Visual Studio Code and Code for IBM i. Today’s topic is Code Coverage.

What is Code Coverage?

This stackoverflow answer explains precisely what Code Coverage is:

Code coverage is a measurement of how many lines/blocks/arcs of your code are executed while the automated tests are running.

A good tool will give you not only the percentage of the code that is executed, but also will allow you to drill into the data and see exactly which lines of code were executed during a particular test.

This is exactly what Code for IBM i can do with the Code Coverage extension.

How do I install it?

Code Coverage for Code for IBM i is currently in early access, available for those who support its development with Code for IBM i Pro subscriptions. After the early access waiting period, we will release it for free to all. It will also be available on GitHub!

You will need to do the following:

  1. Install code coverage on your IBM i. Believe it or not, I couldn’t find a homepage for IBM i Code Coverage from Googling. I did find this PDF from IBM containing a slide with the PTF requirements. See slide 28 on this PDF.
  2. If you’re new to Code for IBM i, read our introductory post for installation instructions.
  3. Install the Code Coverage for IBM i extension into Visual Studio Code.

When you’ve got everything installed into Visual Studio Code, you will see a new extension available in the left-most panel:

The basics

Before we get started, make sure that the CODECOV command is on your library list. In any modern install of Code Coverage, it is usually installed into QGPL, but sometimes it ends up in QDEVTOOLS. Make sure the correct library is on your library list.

To make sure it works, let’s create a source member and then compile it:

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
**FREE
 
Dcl-s anumber int(5);
 
anumber = 5;
 
if (anumber = 10);
  dsply 'The number is 10!';
else;
  if (anumber = 5);
    //This is the only DSPLY that should execute.
    dsply 'The number is 5!';
  else;
    dsply 'The number is not 5!';
  endif;
endif;
 
Return;

Creating and running a test

Since we have the Code Coverage extension installed, you can right-click on most types of sources to create a new Coverage Test. In this case, I called my source member test1.rpgle, and right-clicking on it shows me I can create a new Coverage Test. Upon clicking that menu item, a new wizard will appear when you can enter information about the test—mostly prefilled. I will leave it as the defaults and save it:

If you head over to the Code Coverage extension tab, you will see your newly created test there. When you click on it, it will run the test in the background. As it runs you will see the spinning icon, which indicates it is running. When the test is finished running, it will show you all the results of the test. The results include a list of sources that the Coverage Test ran across and what percentage of that code was executed. You are able to click on a source to show the coverage line-by-line.

If you want to run the test again, you can use the rerun button, which has the refresh-styled icon. (This will rerun all open tests!)

Closing

What you have seen here were the very basics. Code Coverage is most powerful when used in combination with unit tests or functional tests. We could add many programs and service programs into the mix to make much larger tests.

You can find out more about code coverage and VS Code for IBM i at these links:

  • VS Code Code Coverage documentation
  • Visual Studio Code for IBM i: A Resource Guide

For training on this or any other IBM i development technology—including APIs or open source on IBM i—contact us.

Tags: COBOL, code coverage, IBM i, IBMiOSS, IDE, open source, RPG, Visual Studio Code, VS Code
Share this entry
  • Share on Facebook
  • Share on X
  • Share on Pinterest
  • Share on LinkedIn
  • Share on Tumblr
  • Share on Reddit
  • Share by Mail
https://www.seidengroup.com/wp-content/uploads/2017/03/SeidenLogo-180.png 0 0 Liam Barry Allan https://www.seidengroup.com/wp-content/uploads/2017/03/SeidenLogo-180.png Liam Barry Allan2021-07-07 14:36:222023-10-20 16:47:26Visual Studio Code, RPG and Code Coverage
Liam Barry Allan

About Liam Barry Allan

Liam Allan, IBM Champion and consultant with Seiden Group, helps IBM i development teams transform their applications and bridge the gap between traditional and modern ...Read More

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

SUBSCRIBE
Open Thinking
Monthly IBM i Strategy & Tips
  • This field is for validation purposes and should be left unchanged.

IBM i Development

  • RPG, COBOL, SQL, Node,
    PHP, Python, Valance, etc.
  • Modernization. Integration.
  • Web and API Solutions
  • Legacy Maintenance
    ...
LET'S GET IT DONE!

Recent Posts

  • What’s New with Mapepire Database Connector for IBM i
  • Do You Need IBM i Observability?
  • PHP 8.6 is Coming Soon to IBM i
  • Safer npm installation is on the way for Node.js (and all JavaScript)
  • Access Modern Security for IBM i and Connected Web Environments
  • IBM i: A Natural Platform for Agentic AI
  • PHP on IBM i in 2026: The Modernization Engine
  • Your “AS/400” Is a Modern IBM i Platform
  • MCP + AI for IBM i Teams (with a MongoDB example)
  • GnuPG PHP Extension for IBM i: Now Included with Seiden Support

SEIDEN GROUP: Modern Development & Open Source for IBM i

Home   |   Seiden PHP+   |   IBM i Services  |   Support   |   VS Code for i   |   Free Stuff   |   Blog  |   Privacy Policy  |   Contact         201.447.2437

© 2026 Seiden Group, LLC
  • Link to LinkedIn
  • Link to Mail
Link to: Visual Studio Code, RPG and IBM i Link to: Visual Studio Code, RPG and IBM i Visual Studio Code, RPG and IBM i Link to: Solving “curl#6 – getaddrinfo() thread failed to start” Link to: Solving “curl#6 – getaddrinfo() thread failed to start” Solving “curl#6 – getaddrinfo() thread failed to start”
Scroll to top Scroll to top Scroll to top