phatnt95/salesforce-apex-agent

apex-testing

Creates and reviews Salesforce Apex tests, test data factories, bulk tests, negative tests, security tests, asynchronous tests, callout mocks, and behavior-focused test suites.

소스 보기

사용 방법

  1. 설치 명령을 복사하고 자신의 에이전트 환경에 설치하기 전에 소스 패키지를 확인하세요.
  2. 필요한 도구, 인증 정보, 지원 환경은 원본 문서에서 확인하세요.
  3. 입력과 원하는 산출물을 설명하고 출처와 결과를 대조하세요.
npx skills add https://github.com/phatnt95/salesforce-apex-agent --skill apex-testing

시작 전 확인

  • 설치에는 모델 구독, API 한도, 파일 접근 권한이 포함되지 않습니다.
  • 별점 수와 설치 수는 활동 지표이며 독립적인 품질·보안 검증이 아닙니다.
원본 Skill 문서

원본 저장소의 제목, 예시, 코드, 표, 링크, 이미지를 유지해 표시합니다.

Apex Testing

Testing strategy

Test behavior and business outcomes, not just coverage percentage.

Every non-trivial feature should consider:

  1. Happy path.
  2. Boundary/edge cases.
  3. Invalid input.
  4. Bulk input.
  5. No-data behavior.
  6. Permission/security behavior when applicable.
  7. Exception/error behavior.
  8. Async behavior when applicable.
  9. Callout success/failure when applicable.

Test data

  • Prefer isolated test data created by the test or a reusable factory.
  • Avoid depending on existing org data unless the platform requires it and the dependency is explicit.
  • Make test records minimal but realistic.
  • Do not hard-code production IDs.

Assertions

  • Assert meaningful field values, record counts, status transitions, errors, and side effects.
  • Avoid tests that only assert no exception was thrown.
  • Use Test.startTest() / Test.stopTest() to isolate governor limits and flush supported async work.
  • For bulk logic, test a meaningful multi-record collection rather than only a single record.

Callouts

Use HttpCalloutMock or the appropriate test abstraction. Assert both request/response behavior and resulting Salesforce state.

Async

For Queueable, Batchable, Scheduled, and future work, verify the observable outcome after Test.stopTest() and cover failure paths where practical.

Quality gate

Before declaring a test complete, ask:

  • Would this fail if the business rule broke?
  • Does it protect against regression?
  • Does it exercise bulk behavior?
  • Does it verify important negative/security cases?
  • Is it independent of org-specific production data?

관련 작업

같은 저장소의 Skills

더 많은 Skills

모든 Skills