SAP Commerce Unit Tests
Overview
Use this skill to create or update SAP Commerce unit tests and produce verifiable single-test coverage output.
Trigger Checklist
Use this skill when one or more are true:
- writing new unit tests for SAP Commerce classes
- updating/refactoring existing unit tests
- reviewing test quality against project conventions
- running one test with coverage and reporting results
Progressive Disclosure
Load only what the task needs:
references/test-conventions.mdfor naming, structure, mocking rulesreferences/coverage-workflow.mdfor run command and expected outputsreferences/gotchas.mdfor frequent run-time failuresscripts/run_single_test_with_coverage.shfor deterministic execution
Workflow
- Locate or create test class under extension
testsrc. - Apply naming and Arrange/Act/Assert conventions.
- Register in
*-testclasses.xmlif required by the repo. - Run single-test coverage script.
- Report JUnit and coverage metrics with HTML report paths.
Quality Rules
- Keep one scenario per test method.
- Prefer real DTO/data objects; mock behavior dependencies.
- Avoid static mocking patterns.
- Keep assertions explicit and scenario-specific.
Reporting Requirements
Always include:
- JUnit results (tests, failures, errors, time)
- extension coverage metrics
- target-class coverage metrics
- generated report paths
If execution fails, report the exact failure reason and stop claiming pass status.