Skip to content

Commit 069b806

Browse files
docs: update README with clearer local testing instructions (#90)
Clarified instructions for running tests and building Actors locally in the README.
1 parent bbbd758 commit 069b806

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

README.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -307,36 +307,49 @@ describe('standby tests', () => {
307307

308308
## CLI (`apify-test-tools` bin)
309309

310-
The package includes a CLI binary used by CI workflows to build actors, detect changes, and report test results. You can also run it locally for debugging.
310+
The package includes a CLI binary used by CI workflows to build Actors, detect changes, and report test results. You can also run it locally.
311311

312312
### Running locally
313313

314-
The main local flow is: **build** affected actors, then **run tests** against those builds.
314+
Running the testing library locally is useful when you only want to update the testing code in /test because you can iterate on it without pushing new code to the remote.
315+
316+
If you don't need to change any source files and only iterate on /test code, you can skip steps 1-4. But if you want to test vs changed /src, you have to push that GitHub branch since it needs to build the Actors with that code.
317+
318+
The main local flow is:
319+
1. Switch to a dummy branch that you will push and can later delete
320+
2. `npm i apify-test-tools@latest -D`
321+
3. Push your code (changes you want to test)
322+
4. Build Actors on Apify (with your new code)
323+
5. Run tests against those builds. You can change tests and run on the same builds.
315324

316325
`cd` into the actor repository you want to work with (or use `--workspace`).
317326

318-
#### 1. Build affected actors
327+
#### 4. Build affected Actors
319328

320-
Requires `APIFY_TOKEN_<USERNAME>` for each actor owner. The username is derived from the actor name — uppercased with non-word chars replaced by `_` (e.g. actor `john.doe/my-actor` needs `APIFY_TOKEN_JOHN_DOE`).
329+
If you want to test vs existing src code, you can skip this and instead construct the output JSON manually from existing builds only for the Actors you need to test.
330+
331+
Requires `APIFY_TOKEN_<USERNAME>` for all Apify users that own your Actors (`e.g. `apify`, `compass`, `lukaskrivka` users). The username is derived from the actor name — uppercased with non-word chars replaced by `_` (e.g. Actor `john.doe/my-actor` needs `APIFY_TOKEN_JOHN_DOE`).
321332

322333
```bash
323334
APIFY_TOKEN_JOHN_DOE=<token> \
324335
GITHUB_WORKSPACE=. \
325336
npx apify-test-tools build \
326337
--target-branch origin/master \
327-
--source-branch HEAD \
338+
--source-branch origin/my-dummy-branch \
328339
--dry-run
329340
```
330341

331-
Remove `--dry-run` to actually trigger builds. The command outputs a JSON array of build objects to stdout:
342+
Remove `--dry-run` to actually trigger builds and update the branch names/ The command outputs a JSON array of build objects to stdout:
332343

333344
```json
334345
[{ "buildId": "...", "actorId": "...", "buildNumber": "...", "actorName": "john.doe/my-actor" }]
335346
```
336347

337-
#### 2. Run tests against the builds
348+
#### 5. Run tests against the builds
349+
350+
Pass the build output as `ACTOR_BUILDS` and provide `TESTER_APIFY_TOKEN`. The token can point to your own account (if you have enough memory) or you can use the testing account (xRGg9iAfJSymqartk).
338351

339-
Pass the build output as `ACTOR_BUILDS` and provide `TESTER_APIFY_TOKEN` (the token used to call actors and read results):
352+
If you want to run only certain tests, change the `test/platform` to be more specific.
340353

341354
```bash
342355
ACTOR_BUILDS='<JSON output from build command>' \
@@ -353,7 +366,7 @@ BUILDS=$(APIFY_TOKEN_JOHN_DOE=apify_api_xxx \
353366
GITHUB_WORKSPACE=. \
354367
npx apify-test-tools build \
355368
--target-branch origin/master \
356-
--source-branch HEAD)
369+
--source-branch origin/my-dummy-branch)
357370

358371
# Run tests with the builds
359372
ACTOR_BUILDS="$BUILDS" \

0 commit comments

Comments
 (0)