Skip to content
Development
Skill

/sap-run-abap-unit

Executes ABAP Unit tests on a deployed object (program or global class) via SAP GUI Scripting and reports per-method pass / fail with a verdict gate. Opens the object in SE38 / SE24, triggers the ABAP Unit run (via the SE38/SE24 menu), and parses the result display. Closes the

From plugin
sap-dev
8123 skills3 agents
Install
$ npx -y skills add sapdev-ai/sap-dev --skill sap-run-abap-unit --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/sap-run-abap-unit

Context preview

The summary Claude sees to decide when to auto-load this skill.

Executes ABAP Unit tests on a deployed object (program or global class) via SAP GUI Scripting and reports per-method pass / fail with a verdict gate. Opens the object in SE38 / SE24, triggers the ABAP Unit run (via the SE38/SE24 menu), and parses the result display. Closes the

SKILL.md

sap-run-abap-unit.SKILL.md
name: sap-run-abap-unit
description: |
  Executes ABAP Unit tests on a deployed object (program or global class)
  via SAP GUI Scripting and reports per-method pass / fail with a verdict
  gate. Opens the object in SE38 / SE24, triggers the ABAP Unit run
  (via the SE38/SE24 menu), and parses the result display. Closes the
  generate -> deploy -> activate -> TEST loop for /sap-gen-abap output
  (Z<PROGRAM_ID>_TEST) and works standalone on any brownfield object.
  GUI backend, verified on S/4HANA 1909. Results-only by default; with
  --with-coverage it ALSO measures code coverage (Unit Tests With Coverage),
  running the suite twice (counts + coverage) since the coverage display has no
  status-bar summary. The RFC backend (Z_AUNIT_RUN, Phase 2) does both in one
  headless call. Result/coverage component IDs are release-specific; if the skill
  emits NEEDS_RECORDING, record them once with /sap-gui-probe --record (see "Result
  parsing" below).
  Prerequisites: Active SAP GUI session (use /sap-login first); developer
  authorization to run ABAP Unit (S_DEVELOP on the object).
argument-hint: "<OBJECT_NAME> [--type=PROGRAM|CLASS] [--with-coverage] [--min-coverage=<n>] [--mode=GUI] [--save-to=<PATH>]"

SAP ABAP Unit Runner

You execute ABAP Unit tests on a deployed object and apply a pass/fail gate. The GUI backend opens the object, runs ABAP Unit, and parses the result display. With `--with-coverage` it additionally measures code coverage (a second "Unit Tests With Coverage" run). The RFC backend (Phase 2) does both headless.

Task: $ARGUMENTS

---

Shared Resources

| File | Purpose | |---|---| | `<SAP_DEV_CORE_SHARED_DIR>/rules/safety_policy.md` | **Rule 0 (highest priority)** — environment guard; enforced by Step 0.6 via `sap_safety_gate.ps1` | | `<SAP_DEV_CORE_SHARED_DIR>/rules/skill_operating_rules.md` | Mandatory operating rules | | `<SAP_DEV_CORE_SHARED_DIR>/rules/language_independence_rules.md` | GUI-scripting language independence -- identify by component ID, status via `MessageType`, VKey over menu-text, no `.Text`/`.Tooltip` branching | | `<SKILL_DIR>/references/sap_se38_run_aunit.vbs` | Run + parse for a PROGRAM target (SE38) | | `<SKILL_DIR>/references/sap_se24_run_aunit.vbs` | Run + parse for a global CLASS target (SE24) | | `<SAP_DEV_CORE_SHARED_DIR>/scripts/sap_artifact_lib.ps1` | `New-SapScopeKey` / `Register-SapArtifact` — register the result JSON so `/sap-evidence-pack` collects it under the object's scope (Kind `unit_results`). Best-effort; never changes the verdict. |

---

Result parsing (verified live on S/4HANA 1909)

The trigger and result parse were verified end-to-end on S4D (2026-06-03):

  • **Trigger is a menu, not a VKey.** SE38 `Program > Execute > Unit Tests`

(`mbar/menu[0]/menu[9]/menu[2]`); SE24 `Class Source > Run > Unit Tests` (`mbar/menu[0]/menu[7]/menu[0]`). Ctrl+Shift+F10 is SE80-only and raises *"The virtual key is not enabled"* on the SE38/SE24 editor screens.

  • **Failures** open the ABAP Unit Result Display (`Program=SAPLSAUNIT_RSLT_DSPLY*`).

Failures = alert-ALV rows whose `ICON_LEVEL` is **not** tolerable: `@8R` (Tolerable — e.g. a class's "no test relation" warning) is a warning, NOT a failure; `@8O` (Critical) / Fatal are. (A self-testing class with a tolerable "no test relation" warning opens this display even on all-pass ⇒ tolerable-only ⇒ `failed=0`; a class with a normal test relation, and a report, stay on the editor when all-pass. All verified live.)

  • **All pass** stays on the editor with status-bar `MessageType=S`.
  • **No tests** stays on the editor with status-bar `MessageType=W`.
  • The status bar carries the summary (`"... K test methods"`) on every branch;

the VBS reads the last integer (locale-independent digits) as the total.

  • **Coverage** (`--with-coverage`): a second run via `… > Unit Tests With > Coverage`

opens the AUCV display (`Program=SAPLSAUCV_DISPLAY_MULTI_TAB`); the "Coverage Metrics" tab (`tabpFSCOV`) holds a tree whose root-node `PERCENTAGE` is the overall coverage. That display has no status-bar summary — hence the two-phase run. The coverage subscreen number is launch-variant, so the VBS **searches** `tabpFSCOV` for the `PERCENTAGE`-column tree instead of hardcoding the path. Verified live: SE38 `33.33%` (report) and SE24 `50.00%` (class with a `CCAU` test relation). A self-testing class with no production code under test ("no test relation") has no coverage tree ⇒ `coverage=NA`. When a requested coverage read comes back NA, the VBS emits a `COVERAGE_REASON:` line first — `screen unreachable (...)` when the coverage menu never reached the AUCV display, `value cell not found (...)` when AUCV opened but no `PERCENTAGE` tree exists — so the NA is diagnosable.

These are program-name / message-type / row-count signals — all language-neutral. On a **different release**, if the alert-grid path shifts, the VBS prints `UNIT_TEST_RUN: NEEDS_RECORDING program=<P> screen=<S>` instead of a false green; record the new path via `/sap-gui-probe --record` and prepend it to the `gcands` array in both `sap_se38_run_aunit.vbs` and `sap_se24_run_aunit.vbs` (same one-time-per- release model as `/sap-atc`).

---

Step 0 — Resolve Work Directory

Resolve `work_dir` via the env-aware helper (NOT a direct `settings.json` read):

powershell -NoProfile -ExecutionPolicy Bypass -Command ". '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_settings_lib.ps1'; . '<SAP_DEV_CORE_SHARED_DIR>\scripts\sap_connection_lib.ps1'; Write-Output ('WORK_DIR=' + (Get-SapWorkDir)); Write-Output ('RUN_TEMP=' + (Get-SapRunTemp))"

`{WORK_TEMP} = work_dir\temp`. Settings reads follow `shared/rules/settings_lookup.md`.

cmd /c if not exist "{WORK_TEMP}" mkdir "{WORK_TEMP}"

Set `{RUN_TEMP}` = the `RUN_TEMP=` value printed above — a fresh per-run scratch directory `{work_dir}\temp\run_<id>`, already created by `Get-SapRunTemp`. Resolve it **once here** and reuse the same value for the rest of this

Read more
Ships withsap-dev

SAP development automation skills for AI coding assistants. Windows-only — the skills drive SAP GUI for Windows via GUI Scripting (plus optional RFC via SAP NCo); there is no macOS/Linux path.

Get the whole plugin

Other skills on sap-dev.