Skip to content
Back to skills

Abap Unit

ASecurity

Run ABAP Unit tests for a class, program or function group on the connected system, with the right tool and runner for the system (handles systems without /abapunit/runs, e.g. S/4HANA 2023), explain failures by reading the failing test and the code under test, and write new local test classes on request (shown first, test include only, harmless risk level). Use when the user asks to run, write or fix unit tests, check if tests pass, or investigate a failing test.

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 9, 2026
ai-agentssqlrailstestinggitapidatabase

Works with

  • api
  • mcp

Security analysis

A100/100

Scanned November 10, 2026

npx -y skills add CoVeles/claude-abap-dev --skill abap-unit --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Abap Unit?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Abap Unit
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/coveles-abap-unit/badge)](https://www.skillsdirectory.com/skills/coveles-abap-unit)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: abap-unit
description: Run ABAP Unit tests for a class, program or function group on the connected system, with the right tool and runner for the system (handles systems without /abapunit/runs, e.g. S/4HANA 2023), explain failures by reading the failing test and the code under test, and write new local test classes on request (shown first, test include only, harmless risk level). Use when the user asks to run, write or fix unit tests, check if tests pass, or investigate a failing test.
---

# abap-unit — run and explain ABAP Unit tests

Before the first tool call, read `../../reference/tools.md` and `../../reference/guardrails.md`.

## 1. Run
- **mcp-abap-adt present:** `RunUnitTest(class_name)` (programs, function groups and modules have
  their own `Run…UnitTest` tools). If it fails with **404 on `/sap/bc/adt/abapunit/runs`**, the
  system only offers the older endpoint (tools.md) — not a test problem: repeat with
  **`runner: "sync"`** (mcp-abap-adt 20.1+). On an older mcp-abap-adt without `runner`, switch to vsp.
- **vsp present (or mcp-abap-adt can't run it):** `RunUnitTests(object_url)`. Default risk levels only:
  pass `include_dangerous=true` / `include_long=true` **only** if the user explicitly asks — tests
  with RISK LEVEL DANGEROUS may change data.
- **Neither works:** say what failed and ask the user to run the tests in ADT (Ctrl+Shift+F10)
  and paste the result.

## 2. Read the result honestly
- Report counts: test classes, methods, passed, failed, errors, not run.
- **No test class found / 0 methods ran is not "green".** Say the object has no (runnable) tests.
- A test class that aborts (setup failure, runtime error) is a failure even if no assertion failed.

## 3. Explain failures
For each failing method: read the test method (local test classes via `GetLocalTestClass` or
vsp `GetSource(..., include='testclasses')`) and the production code it exercises. State:
- what the test expects (the assertion, `exp`/`act`),
- what the code does instead, with line numbers,
- the most likely cause — marked as your assessment unless the code makes it certain.

## 4. Fixing
Propose fixes to **production code** first. Changing a test's expectation to make it pass needs
the user's explicit confirmation that the old expectation was wrong. Writes follow the batch rules
of the `atc-fix` skill (diff → OK → write → check → activate), then re-run the tests.

## 5. Writing new tests (when the user asks for them)
- Read the class first; list the behaviours worth testing and which need the database. Show the
  **complete test class** and wait for an explicit OK before writing (guardrails 4, 5a).
- Touch only the **test-class include** (mcp-abap-adt `UpdateLocalTestClass`, or vsp
  `WriteSource(..., include='testclasses')` / `test_source`). The production class stays unchanged;
  to reach private methods use `CLASS <cut> DEFINITION LOCAL FRIENDS <test class>.`
- `RISK LEVEL HARMLESS`, `DURATION SHORT`. No real database writes: test DB-free logic directly;
  for SQL use the ABAP SQL test double framework (`cl_osql_test_environment`) or CDS test doubles —
  look up the API with the `sap-kb` skill before using it.
- After writing: activate, run the tests (section 1), report counts.
- If the project keeps ABAP sources in a git repo, point out that the new test include exists only
  on the system until it is added to the repo.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.