Integration Testing¶
Every new method must have an integration test. These run against a live API and catch issues unit tests miss — wrong endpoints, broken transforms, and auth/header problems.
Environment configuration¶
Integration tests read their configuration from tests/.env.integration. Create that file (it is git-ignored — never commit it) and populate it with the variables.
The full, current set of config values lives in the team Slack canvas: UiPath SDK – Integration Test Config (.env). Copy them into your local tests/.env.integration and fill in UIPATH_SECRET with your own PAT from the procodeapps org.
Create test artifacts in the integrationtest tenant, inside the "Integration Test" folder. Keeping all test data in this dedicated tenant and folder avoids polluting shared environments and keeps cleanup predictable.
Where tests live¶
Add your test under tests/integration/shared/{domain}/, mirroring the service domain it covers.
Setup helpers¶
- Use
getServices()andgetTestConfig()fromtests/integration/config/unified-setup.ts - Use
registerResource()fromtests/integration/utils/cleanup.tsfor cleanup tracking - Use
generateRandomString()fromtests/integration/utils/helpers.tsfor unique test data
Guidelines¶
- Tests run in both
v0andv1init modes viadescribe.each(modes)— only if the service is registered in both modes inunified-setup.ts. New services that only supportv1init should use['v1']only. - Always
throw new Error()when test preconditions are not met — whether it's missing config (e.g., nofolderId) or missing test data (e.g., no running jobs). Never useconsole.warn()+returnto silently skip — silent skips hide unrunnable tests and make CI green when tests aren't actually exercised. describe.skipis permitted only when the service does not support PAT auth (e.g., endpoints that require OAuth). Write the full test body as if it will eventually run, add a comment explaining the limitation, and usedescribe.skiprather than omitting the test. Do not usedescribe.skipfor missing test data, missing config, or flakiness — those require abeforeAllguard or athrow.- Never wrap integration test API calls in try/catch — let errors propagate naturally. Silent catches mask real failures.
- Never write redundant tests — each test must cover a distinct code path, error scenario, or response-shape aspect.
- Extract shared data lookups to
beforeAll— fetch setup data once and store it in alet variable!: Typevariable rather than repeatinggetAllcalls in eachitblock. - Clean up after deletes — after a successful delete, remove the resource from the cleanup array so later cleanup doesn't try to delete an already-deleted record.
- Include a transform validation test for methods with a transform pipeline. Verify both that (a) transformed camelCase fields exist and have values (
job.createdTime,job.processName), and (b) original PascalCase API fields are absent ((job as any).CreationTimeisundefined).