/sc4sap:program-testfrom sc4sap
Tests ABAP programs on DEV using real data (DEV/QA/production via SM59) with ABAP Unit, masking sensitive data via MCP. Verdicts from ABAP Unit, not the agent. Supports Korean requests.
Ships in sc4sap. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Offline profile (
common/offline-mode.md): blocked — reply with the stop line there and stop.
Runs the program's real code on DEV against realistic rows, so the developer knows whether it does what the spec says before the transport goes to QA. Nothing runs on QA or production, nothing is written there, and the program under test is never changed.
"It worked with my test data" is the usual reason a program fails in QA. This skill tests with the data the program will meet — DEV's own by default, or a sample of QA / production rows on request — while keeping the run honest: expected results are frozen before the code runs, verdicts come from SAP's ABAP Unit result, and the tests must prove they can fail.<Response_Prefix>Every response triggered by this skill MUST begin with [Model: <main-model> · Dispatched: <sub-summary>] per ../../common/model-routing-rule.md § Response Prefix Convention.</Response_Prefix>
<Phase_Banner>Before each Agent(...) dispatch, emit ▶ phase=<id> (<label>) · agent=<name> · model=<Opus|Sonnet|Haiku> per ../../common/model-routing-rule.md § Phase Banner Convention. Resolve the dispatch mode (../../common/model-dispatch-mode.md) and the cost mode (../../common/cost-mode.md; eco → pass both model and effort per the table below, Skill("sc4sap:eco", "--attach") first and on every continuation turn).</Phase_Banner>
<Team_Mode>No teamMode integration. One agent per phase; the independent check is a fresh sap-critic.</Team_Mode>
<Use_When>
/sc4sap:create-program finished (its report offers this skill with the program name and spec)<Do_Not_Use_When>
/sc4sap:create-program (it writes its own unit tests in Phase 5)/sc4sap:analyze-code · a dump in a run → /sc4sap:analyze-symptom/sc4sap:uat-scenarios$TMP on DEV) → stop with the tier message from pt.mjs init
</Do_Not_Use_When><Decisions_Fixed>
| Topic | Decision |
|---|---|
| Data source | dev (default, the connected DEV system, no destination) · qa · prd — chosen per run. QA / PRD rows come only through GetRemoteTableContents with the destination in the profile config.json → testDataSources (data-sources.md). Missing destination blocks only that choice; the skill never creates SM59 entries |
| Where code runs | DEV only, in $TMP harness programs (<PROG>_PT, mutants _M1…_M3, tamper _TX). No transport, no SAP standard object, the program under test untouched |
| Order | cases → expected → data plan → reads → freeze → harness → run → mutants + tamper → verdict. Expected values are written before any code runs and frozen by hash |
| Personal data | Every read during a run carries mask (the run's salt): the MCP server masks personal fields default-deny before the answer leaves it, and the read gate (pt-gate.mjs) denies a read without it. Personal / credential tables refused; tokens are HMAC under a key only the MCP server holds; the capture hook saves only server-masked rows (data-sources.md § Masking) |
| Row caps | Default 20 per table, max 200; only the fields the logic reads; QA needs a WHERE on key / indexed fields |
| Production | The user's choice per run (MASKING_RELEASE_PINNED is true since the MCP masking release, sc4sap 0.6.70). Guards: testDataSources.prd must be set (else exit 5); the gate lets PRD reads through only after one masked probe read in the same run proved the server masks (an older server ignores mask), and only through the run's own destination; unmasked answers are never saved; the plan rules apply (fields, WHERE, ≤ 200 rows, refused tables). Every PRD table read is its own confirmation (dest, table, fields, WHERE, cap shown); the GetRemoteTableContents permission prompt is never pre-approved |
| Test doubles | S/4 (≥ 7.51): CL_OSQL_TEST_ENVIRONMENT. ECC / < 7.51: override of the data-access method or the routine fed with internal tables. A case whose DB access cannot be doubled = NOT_TESTABLE, never PASS (harness.md) |
| Verdict | From the evidence ledger (ABAP Unit result per method) by pt.mjs verdict: PASS · PARTIAL (all testable green, some not testable) · PROGRAM_DEFECT · TEST_WEAK · INCOMPLETE · INVALID · NOT_TESTABLE (verification-loop.md) |
| Loop | ≤ 5 rounds; only the test class changes; expected values change only with a spec citation and the user's yes |
| Systems | Same flow on ECC and S/4; S/4 runs program containers with MCP ≥ the version that adds RunUnitTest PROG on S/4 (older MCP → INCOMPLETE with the tool error) |
| Output | <base>/program/<PROG>/test/<run>/ (artifact base per ../../common/multi-profile-artifact-resolution.md): cases.json, expected.json, plan.json, test-class.abap (agents) · state.json, rows/ (masked), src/, ddic/, harness/, pt-receipt.json, report.md (scripts / hook only — the evidence guard blocks agent writes) |
| </Decisions_Fixed> |
Progress. Before each step print one line Step <n> of 0–11 — <label> (user's language) next to the phase banner, so a long run never looks stuck.
Step 0 — Scope. From ARGUMENTS / the create-program hand-off: program name, spec path (spec= argument, else spec.md in <base>/program/<PROG>/ or .sc4sap/program/<PROG>/), data source (default dev). Program name missing → ask in plain text with an example ("Which program? e.g. ZMMR0010"). Then one AskUserQuestion with only the questions still open (skip one the arguments answer):
DEV (Recommended): the connected DEV system's rows, nothing to set up · QA: a masked sample of QA rows over testDataSources.qa, nothing written to QA (offered only when it is set or the user asked for QA) · PRD: only when the user asked for production — masked, each table asked one by one (then init --source prd). Not offered = not listed; when DEV is the only choice, skip the question.../../common/cost-mode.md leaves it open (no --eco / --standard, no costModeBySkill / costMode preference, not started through /sc4sap:eco): Standard (Recommended) (the skill as written) · Economy (cheaper sub-agent models, the same checks: planted bugs, tamper copy, independent review). Economy = this run is --eco: Skill("sc4sap:eco", "--attach") before the first dispatch, as in § Eco.Source only (the report says the source is the only rule basis) · I'll give a path or paste it.
Then print the run plan in three lines before anything runs: (1) Steps 0–11, about 3–4 agent dispatches per round, up to 5 rounds; (2) what you will be asked: the data plan (once), CreateProgram / UpdateProgram / ActivateObjects / RunUnitTest for up to five $TMP programs (<PROG>_PT, _M1–_M3, _TX), each production table; (3) nothing on QA / production is written and the program under test is never changed. Invoke /sc4sap:trust-session with parent_skill=sc4sap:program-test.Step 1 — Init. <PT> init --program <PROG> --source <dev|qa|prd> (--base per § Web intake). Exit 5 → the destination is not set: show the printed SM59 how-to and say it is saved with /sc4sap:sap-option → Test data sources; offer dev instead (AskUserQuestion: Use DEV rows (Recommended) · Stop and set the destination first). Exit 6 → not a DEV profile, stop. Then read the program's source with GetProgram (and GetIncludesList + GetInclude for each include) — the capture hook saves it under <run>/src/.
Step 2 — Cases (▶ phase=2 (cases) · agent=sap-analyst · model=Opus). Dispatch "sc4sap:sap-analyst" with the spec, the source path list and harness.md § Cases. It returns cases.json: every rule of the spec and every branch of the source gets a case (positive, negative, empty input, boundary), each citing the spec section and the condition line(s) it exercises (INCLUDE:line), the tables it needs, the double kind, or testable: false with the reason. Write the file to <run>/.
Step 3 — Coverage review (▶ phase=3 (coverage) · agent=sap-critic · model=Opus). Dispatch "sc4sap:sap-critic" with spec + source paths + cases.json: missing rules, missing negative / empty cases, wrong NOT_TESTABLE claims. Apply its findings (one round), then <PT> check --run <run> until only the data-plan and expected items remain.
Step 4 — Data plan + reads. Write <run>/plan.json (per table: fields, WHERE, max_rows, cases; personal_reason when a personal field is needed). <PT> check. Show the plan as one table and get the user's go (QA: once for the plan). Optionally GetTable for a planned table to spot custom personal fields for mask-extra (the capture keeps its field list under <run>/ddic/); the server reads the DDIC itself for masking. Then read, one table per call; a GetSqlQuery must fit the strict grammar of data-sources.md § Masking (plain fields, one table, simple WHERE) or its rows are not saved:
mask: { salt: <state.json salt>, extra_fields: <state.json mask_extra> } — the gate denies it otherwise.dev → GetSqlQuery (sql_query = SELECT <fields> FROM <table> WHERE …, row_number = max_rows) — per-call consent applies.qa / prd → GetRemoteTableContents with destination = the run's destination, fields, where, max_rows. prd: first one masked probe on DEV (GetSqlQuery SELECT mandt FROM t000 UP TO 1 ROWS with the mask); a denied probe means the MCP server cannot mask — stop and say so.
Blocklist denials are final — drop the table and mark its cases NOT_TESTABLE. Extra personal fields found in DDIC (custom ZZ* names, addresses in text fields) → <PT> mask-extra --run <run> --fields … before the read. The server's name / data-element shapes are generic; customer-specific personal fields always need mask-extra — above all one typed with a clear-list data element (e.g. a person's ID in a Z field typed KUNNR).Step 5 — Expected (▶ phase=5 (expected) · agent=sap-analyst · model=Opus). Dispatch "sc4sap:sap-analyst" with the spec, cases.json and the masked rows (<run>/rows/*.json, never the raw response). It derives each case's expected values from the spec rules and the rows — not from running or reading the program's output logic line by line — and states the basis. Write expected.json, then <PT> check → <PT> freeze --run <run>.
Step 6 — Harness (▶ phase=6 (harness) · agent=sap-qa-tester · model=Sonnet). Dispatch "sc4sap:sap-qa-tester" with harness.md, cases.json, expected.json, the double kind per case, the release (config.json), and the VALUE rows from <PT> abap-rows --run <run> --table <T>. It returns test-class.abap only (no SAP writes). Write it to <run>/, then <PT> harness --run <run> (lint: every case method, value assertions with the frozen expected literals, HARMLESS, no DB writes, no unmasked values). Lint problems → back to the same agent with the list.
Step 7 — Run. Main thread, once per run first: SearchObject for each of the five names (init printed them) — any hit means the name is taken: stop and report, never update or activate a program this run did not create (on the web the server enforces it). Then: CreateProgram ($TMP) + UpdateProgram with the exact text of <run>/harness/<PROG>_PT.abap → ActivateObjects → RunUnitTest (container_type: PROG; S/4 then GetUnitTestStatus / GetUnitTestResult). Activation error → the error goes back to Step 6 (test class only).
Step 8 — Test the test. <PT> mutants --run <run> writes up to 3 mutants (a flipped condition on a cited line) and one tamper copy (one expected literal changed). Upload, activate and run each exactly like Step 7. Exit 1 (no condition line cited, no literal found) → back to Step 2 for the cited lines.
Step 9 — Verdict + loop. <PT> verdict --run <run> → pt-receipt.json, report.md, exit code. Then follow verification-loop.md: fix the test and repeat Steps 6–9, or stop. ≤ 5 rounds.
Step 10 — Independent check (▶ phase=10 (verify) · agent=sap-critic · model=Opus, fresh dispatch, no earlier findings). Inputs: spec, source paths, cases.json, expected.json, test-class.abap, pt-receipt.json. It answers: does each expected value follow from the spec and the masked rows; does each assertion test the case's rule; is any NOT_TESTABLE avoidable. A finding → back to the loop (counts as a round).
Step 11 — Report + close. <PT> close --run <run>. Report (user's language): verdict line, the evidence lines from report.md (copied, never upgraded), the NOT_TESTABLE share in the first lines, data source and tables read with row counts, what was written on DEV ($TMP program names), the report path. Offer to delete the $TMP programs — each DeleteProgram needs the user's yes per call. Then one Next line by verdict (offer, never start): PASS / PARTIAL → /sc4sap:transport-readiness <request> before the move · PROGRAM_DEFECT → the failing cases with their spec section, and /sc4sap:analyze-code <PROG> · TEST_WEAK / INCOMPLETE → what blocked the loop and a re-run once it is fixed.
<Web_Intake>
A web run sends the form values as lines (Program name:, Data source: DEV|QA|PRD, Mode: Economy|Standard, Spec:); they answer Step 0's questions — do not ask them again. The web names an output folder: init --base <folder> (the run folder becomes <folder>/program/<PROG>/test/<stamp>/).
</Web_Intake>
Never skipped in eco: coverage review, freeze, mutants, tamper, the independent check, masking (server-side, every read), the production probe and per-table confirmation.
<MCP_Tools_Used>
GetProgram, GetIncludesList, GetInclude, GetTable / GetStructure / GetDataElement (field meaning, personal fields), GetSqlQuery (DEV rows), GetRemoteTableContents (QA rows), CreateProgram, UpdateProgram, ActivateObjects, GetInactiveObjects, RunUnitTest, GetUnitTestStatus, GetUnitTestResult; DeleteProgram only on the user's per-call yes.
</MCP_Tools_Used>
<Related_Skills>
/sc4sap:create-program — builds the program; its Phase 8 report hands over to this skill/sc4sap:transport-readiness — after a green test, whether the request can move/sc4sap:sap-option — testDataSources (QA / PRD destinations)
</Related_Skills>Task: $ARGUMENTS
What SKILL.md sets; muted values are Claude Code's defaults
inheritThree short reads, in order
abap-unit, test-doubles, data-masking, sap-testing, program-test
npx claudepluginhub babamba2/superclaude-for-sap --plugin sc4sap31 skills in this plugin
/adobe-from-pdfBuild an Adobe form (SFP — interface, context and XDP layout) from a PDF of the printed form, the way smartform-from-pdf builds a SmartForm, upload it to the DEV system, print it there and score the print against the source page. Awaiting approval — not runnable yet./adobe-previewDraw the expected print of an Adobe form (SFP, S/4HANA) as HTML pages in mm (plus JPG / PDF with a local browser) — the XFA layout with its master pages, flowed tables with repeated headers, page breaks, captions, pictures (dates, numbers, currency shifts), rich text with embedded fields, rounded boxes and images — filled with invented sample values sized to the interface's DDIC types. On a development system it can print SAP's example forms through ADS and score the preview against SAP's own PDF./analyze-codeABAP code analysis — size-gated review (one Opus sap-code-reviewer, or Haiku sap-checker detectors + Opus judge for large objects), Haiku evidence check on every finding, then a canned report or a richer briefing on the main thread/analyze-symptomRead-only, step-by-step root cause analysis for SAP operational errors. Reads the dump summary and failing source via MCP (known-issue web lookup only when the failure is in standard SAP code), widens to transports and where-used only when the clues call for it, narrows hypotheses with minimal user questions, and provides SAP Note search keywords. Never changes code or data./ask-consultantDirect operational Q&A with a SAP module consultant agent. Auto-routes the question to the matching sap-{module}-consultant and answers against the configured SAP environment (version, industry, country, active modules)./assistBusiness assistant for the connected SAP system — looks up and changes specific documents through the installed business actions (query → preview → user confirm → execute), one confirmed step at a time. Use for requests about concrete SAP data such as open purchase orders, goods receipt, delivery complete, PO release, production order release / confirmation / TECO, sales order create or change, delivery / billing block, post goods issue, billing, FI document display or reversal, payment block, G/L posting, internal order status, cost center actuals, cost repost or activity allocation, document output status or reprint, shipments, picking, packing / handling units, shipment costs, warehouse transfer orders and requirements, bin and warehouse stock (ECC LE / WM), maintenance notifications and orders, equipment, functional locations and maintenance plans (ECC PM), EWM warehouse tasks, warehouse orders, bins, stock locations, handling units and delivery warehouse progress (S/4 EWM, lookups only). Korean requests too — 미결 PO, 입고, 완결, 납기 변경, 승인, 생산오더, 실적 등록, 기술적 완료, 판매오더, 출하 보류, 청구 보류, 출고 전기, 청구 생성, 전표 조회, 역분개, 지급보류, 분개 전기, 내부오더, 코스트센터 실적, 비용 재전기, 활동 배부, 출력 상태, 재출력, 운송/선적 생성, 피킹, 포장, HU, 운송비, 이전오더(TO) 생성/확정/취소, 이전요청(TR), 저장빈, 창고 재고, 재고실사, 보전오더, 보전통지, 고장 통지, 설비, 기능위치, 보전계획, 보전오더 기술적 완료, 미결 창고작업, 창고작업 조회, 창고오더, 빈 저장빈, 재고 위치, 납품 창고 진행, 검사로트, 사용결정, 검사결과 입력, 품질통지. Not for how / why / configuration questions (ask-consultant).Other plugins' skills for the same job