Skip to content

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.

kotlin
// Android
val config = TakeNIDConfig(captureOnly = true)
swift
// iOS
let config = CESTakeNidConfig(captureOnly: true)
dart
// 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.

bash
# 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 case

This 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:

FixtureExpected result
Clean imageThe happy path. Expect verdict: good.
BlurredExpect not_qualified or image1_not_qualified.
Glare over the ID numberExpect image1_glare — check your app asks for the right side to be retaken.
PhotocopyExpect photocopied.
Two cards in one frameExpect multicard_image.
Card photographed off a screenExpect non_liveness at the tampering step.
Selfie with several peopleExpect image_has_multiple_faces.
Selfie with an occluded faceExpect occluded_face.
Someone else's selfieExpect unmatched at Compare Faces.

→ Verdict Definitions

Exercising API Failures ​

Several error codes are reachable without special images:

CodeHow to trigger
4001001Send an expired X-TV-Timestamp.
401100Sign with the wrong Access Key.
4041000Pass an image_id that does not exist.
4131000Upload an image over 15MB.
4151000Upload a file that is not JPG or PNG.
2001026Pass the same image_id as both image1 and image2 to Compare Faces.
2001003Pass an image with no face to Compare Faces.

→ Error Codes

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 ​

Developers