Skip to content
Skills Library
Programming · Testing

objectscript-coverage

/objectscript-coverage

Measure ObjectScript line coverage using iris_coverage. Use when a user asks about test coverage, coverage reports, or wants to know how well their test suite exercises their code.

Licence
MIT
Last repository change
25.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 25.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Measure ObjectScript line coverage using iris_coverage. Use when a user asks about test coverage, coverage reports, or wants to know how well their test suite exercises their code.

Original author description

Measure ObjectScript line coverage using iris_coverage. Use when a user asks about test coverage, coverage reports, or wants to know how well their test suite exercises their code.

How it works

  1. Purpose
  2. Quick Start
  3. Pre-flight Check
  4. Modes
  5. Parameters
  6. Response
  7. Inline coverage with iristest
  8. TestCoverage IPM Package
  9. Best Practices
  10. Error Codes
Original SKILL.md headings · 156 lines, 796 words
SKILL.md preview
---
name: objectscript-coverage
tier: extra
description: Measure ObjectScript line coverage using iris_coverage. Use when a user asks about test coverage, coverage reports, or wants to know how well their test suite exercises their code.
license: MIT
metadata:
  version: "1.0.0"
  author: InterSystems Developer Community
  compatibility: objectscript, iris
---

## Purpose

Measure line coverage for ObjectScript classes using `iris_coverage`. Coverage tells
you which executable lines were hit during a test run — essential for knowing whether
your test suite exercises production code.

## Quick Start

> **Toolset note:** `iris_coverage` is only available in the **merged toolset**. If it
> returns `NOT_IMPLEMENTED` or is absent from the tool list, add `toolset = "merged"` to
> `.iris-agentic-dev.toml` or set `IRIS_TOOLSET=merged`.

Most tasks need `mode=run` — it starts the monitor, runs tests, stops, and returns results:

```text
iris_coverage(
  mode="run",
  classes=["MyApp.MyClass", "MyApp.OtherClass"],
  test_path="MyApp.Tests",
  namespace="USER"
)
```

Or use `package` to auto-discover all concrete classes:

```text
iris_coverage(
  mode="run",
  package="MyApp",
  test_path="MyApp.Tests"
)
```

## Pre-flight Check

Before running coverage, verify the monitor is available:

```text
iris_coverage(mode="check", namespace="USER")
```

Expected response: `{ok: true, bbsiz_state: "ready"}`

If you get `BBSIZ_NOT_CONFIGURED`:

1. Open Management Portal → System Administration → Configuration → Additional Settings → Advanced Memory
2. Set `gmheap` to `256` (or higher)
3. Restart IRIS — gmheap takes effect at startup only

## Modes

| Mode     | What it does                                                                |
| -------- | --------------------------------------------------------------------------- |
| `run`    | Start + RunTest + Stop + Report in one call. **Use this for most tasks.**   |
| `check`  | Pre-flight: verify monitor is available. Run before first coverage attempt. |
| `start`  | Start monitoring (manual flow).                                             |
| `stop`   | Stop monitoring (manual flow).                                              |
| `report` | Collect results after manual stop.                                          |

## Parameters

| Parameter        | Required for     | Description                                                                                                                            |
| ---------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `mode`           | Always           | `run`, `check`, `start`, `stop`, or `report`                                                                                           |
| `classes`        | start/run/report | Explicit class list (e.g. `["MyApp.MyClass"]`). Mutually exclusive with `package`.                                                     |
| `package`        | start/run/report | Auto-discover concrete classes (e.g. `"MyApp"`). Expands via `%Dictionary.ClassDefinition`.                                            |
| `test_path`      | run              | Compiled class pattern for `%UnitTest.Manager.RunTest` (e.g. `"MyApp.Tests"`). `/noload` always used — classes must be compiled first. |
| `target_pct`     | optional         | Coverage target percentage. Response includes `meets_target: true/false`, or `null` when no lines were counted or the run threw.       |
| `namespace`      | optional         | IRIS namespace. Defaults to connection default.                                                                                        |
| `cobertura_path` | optional         | Path for Cobertura XML output. Requires TestCoverage IPM package (`zpm "install testcoverage"`).                                       |

## Response

```json
{
  "success": true,
  "total_pct": 73.4,
  "hits": 45,
  "total": 61,
  "meets_target": false,
  "target_pct": 90.0,
  "testcoverage_available": false,
  "testcoverage_hint": "Install with: zpm \"install testcoverage\"",
  "classes": [
    {
      "class": "MyApp.MyClass",
      "routine": "MyApp.MyClass.1",
      "hit": 45,
      "total": 61,
      "pct": 73.8
    }
  ]
}
```

## Inline coverage with iris_test

`iris_test(coverage=true)` runs tests and returns line coverage inline in a single call —
no separate `iris_coverage` invocation needed:

```text
iris_test(
  pattern=":MyApp.Tests.OrderTest",
  namespace="USER",
  coverage=true,
  coverage_target_pct=80.0
)
```

The response includes a `coverage` field with the same structure as `iris_coverage` output.

Use this for quick coverage checks during development. Use `iris_coverage(mode=run)` when
you need a detailed per-class breakdown, Cobertura XML output, or want to instrument
specific classes that differ from the test path.

## TestCoverage IPM Package

`iris_coverage` checks for the [TestCoverage](https://github.com/intersystems/TestCoverage)
IPM package (`testcoverage`). If installed, it unlocks:

- Cobertura XML output (CI/CD integration)
- Per-method coverage detail
- Python-embedded coverage

Install: `zpm "install testcoverage"` (requires IPM)

The `testcoverage_available` field in every response tells you whether it's present.
When it's `false`, a `testcoverage_hint` with install instructions is also returned.

## Best Practices

- Always run `mode=check` on a new instance before attempting coverage
- Use `mode=run` for automated workflows — it handles the full lifecycle atomically
- Compile test classes before calling `iris_coverage` — use `iris_compile` first
- Use `target_pct` to enforce a coverage gate in CI: check `meets_target` in the response
- Coverage measures **line** execution, not branch or path coverage
- A class with `pct: null` had no lines counted (never loaded during the run, or nothing executable): that is not 0%

## Error Codes

| Code                       | Meaning                                              | Fix                                                                         |
| -------------------------- | ---------------------------------------------------- | --------------------------------------------------------------------------- |
| `BBSIZ_NOT_CONFIGURED`     | `gmheap` too small for monitor                       | Increase `gmheap` to 256+ in Management Portal, restart IRIS                |
| `MONITOR_IN_USE`           | A line monitor is already running; it was left alone | It may be another session's. `mode=stop` stops it, if it is yours           |
| `COVERAGE_ROUTINE_UNKNOWN` | A class has no compiled routine                      | Check the class name and compile it; nothing ran                            |
| `NO_CLASSES`               | Package expansion found nothing                      | Check package name; verify classes are compiled                             |
| `MISSING_PARAM`            | Required param absent                                | Add `test_path` for `mode=run`; add `classes` or `package` for start/report |
| `INVALID_ACTION`           | Unknown mode string                                  | Use: `run`, `check`, `start`, `stop`, `report`                              |

## Related skills

- **objectscript-tdd** — TDD loop that naturally leads to coverage measurement
- **objectscript-unit-test** — writing the test suite that iris_coverage measures
- **iris-agentic-dev** — if iris_coverage returns NOT_IMPLEMENTED, check your toolset setting

Versions

The database has no other skills named objectscript-coverage.

Database snapshot: 13.11.2026 · package version c553056890d6 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100objectscript-tdd
    Compile-test-fix loop for ObjectScript development. Use when writing or modifying ObjectScript classes.
  • 95objectscript-list-patterns
    ObjectScript %List, %ListOfDataTypes, $LISTBUILD, $LISTTOSTRING, $LISTNEXT patterns. Use when building, iterating, merging, or converting lists in ObjectScript.
  • 90test-coverage-quality-review
    Use this skill when reviewing a test suite for assertion quality rather than coverage percentage — detecting coverage theater, where line/branch coverage is high but the tests would not catch a regression. Trigger when a user provides test files, a coverage report, or asks…
  • 84test-coverage-assistant
    [UDS] 以八维度框架分析代码层级的测试覆盖率,并建议该优先补上哪些缺口。 Use when: 覆盖率数字看起来很健康但缺陷照样流出、要在行覆盖率之外判断测试完整性、设定覆盖率目标。 Not for: 需求层级的 AC 与测试追踪——请用 /ac-coverage;补写缺少的测试——请用 /tdd 或 /spec-derive。 Keywords: test coverage, eight dimensions, line coverage, branch coverage, test quality, 测试覆盖率, 八维度, 测试完整性, 覆盖缺口.
  • 100bun-test-coverage
    Use for test coverage with Bun, --coverage flag, lcov reports, thresholds, and CI integration.
  • 100test-coverage-guardian
    Analyze test coverage, identify gaps, detect dead code, and improve test quality. Use when user asks to check coverage, review tests, find untested code, or improve test robustness.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.