Testing
How to exercise an eKYC integration without a real customer or a real camera.
Capture Without Running Checks
All three Mobile SDKs take a captureOnly flag. With it set, the SDK captures the image and stops — no upload, no quality check, no OCR. Useful while building the UI, before you want to spend API calls.
// Android
val config = TakeNIDConfig(captureOnly = true)// iOS
let config = CESTakeNidConfig(captureOnly: true)// Flutter
final config = TakeNIDConfig(captureOnly: true);→ Mobile SDK Overview § Capture Options
Run From Fixtures, No Camera
The API takes an image_id and does not care where the image came from. Upload a set of fixture images once, then reuse the IDs across every test run.
# Upload once
curl -X POST '<BASE_URL>/v1/images' \
-H 'Authorization: ATV <ACCESS_ID>:<SIGNATURE>' \
-H 'X-TV-Timestamp: <TIMESTAMP>' \
-F 'file=@"fixtures/nid-front.jpg"' \
-F 'label="id_card.vn.national_id.front"'
# Reuse the image_id for every test caseThis runs the whole Onboard a New Customer flow from the command line.
The Fixture Set You Need
To exercise the failure branches you need deliberately bad images, not just good ones:
| Fixture | Expected result |
|---|---|
| Clean image | The happy path. Expect verdict: good. |
| Blurred | Expect not_qualified or image1_not_qualified. |
| Glare over the ID number | Expect image1_glare — check your app asks for the right side to be retaken. |
| Photocopy | Expect photocopied. |
| Two cards in one frame | Expect multicard_image. |
| Card photographed off a screen | Expect non_liveness at the tampering step. |
| Selfie with several people | Expect image_has_multiple_faces. |
| Selfie with an occluded face | Expect occluded_face. |
| Someone else's selfie | Expect unmatched at Compare Faces. |
Exercising API Failures
Several error codes are reachable without special images:
| Code | How to trigger |
|---|---|
4001001 | Send an expired X-TV-Timestamp. |
401100 | Sign with the wrong Access Key. |
4041000 | Pass an image_id that does not exist. |
4131000 | Upload an image over 15MB. |
4151000 | Upload a file that is not JPG or PNG. |
2001026 | Pass the same image_id as both image1 and image2 to Compare Faces. |
2001003 | Pass an image with no face to Compare Faces. |
Easy Mistakes
WARNING
HTTP 200 does not mean pass. Every endpoint returns 200 once the request is processed, even when the business check fails. A test that only asserts the status code passes even when the verdict is photocopied. Always assert through success, then data.status, then the verdict.
WARNING
Do not test with real NID images belonging to colleagues or acquaintances. That is real identity data, and uploaded images persist on the platform. Use the sample cards CAKE provides.
index_faces_sync writes to a real collection. On a shared tenant, delete what you indexed afterwards — otherwise the next duplicate check matches against your own test data.
Next Steps
- Getting Started — the first run, with cURL
- Error Codes — the full code tables
- Onboard a New Customer — the flow to test against