Tools

What is the Test Runner?

The Test Runner is a testing tool that runs your Apify actor with predefined test inputs and automatically validates the output against assertions you define, giving you confidence that your actor works correctly before you deploy it to the Apify Store. Each test case in the Test Runner consists of three parts: input parameters that define what to feed your actor, output assertions that define what you expect to get back, and optional metadata like test name and timeout. Input parameters can be any valid JSON that matches your actor's input schema — for example, a specific search query, a list of URLs, or configuration options. Output assertions let you specify expected minimum result counts (e.g., at least 10 results), required fields that must be present in every output item (e.g., every result must have a title, url, and price), field type constraints (e.g., price must be a number, not a string), and value range checks. Here is a practical example. Say you have a Google Maps scraper. You might define three test cases: one that searches for 'coffee shops in London' and expects at least 5 results with name, address, and rating fields; one that searches for a specific place by URL and expects exactly 1 result with all detail fields populated; and one that uses an empty search to verify your actor handles edge cases gracefully without crashing. The Test Runner supports two execution modes. Local mode runs your actor on your machine using the Apify CLI, which is free and fast — ideal for development iteration. Cloud mode triggers an actual actor run on the Apify platform, which costs standard PPE credits but tests in the real production environment where your actor will ultimately run. Cloud mode catches issues that local testing misses, such as Docker build problems, missing dependencies, and network-level differences. Run all your test cases with a single command to get a complete pass/fail report. Integrate it with Regression Tests for automated pre-deploy validation across your entire test suite. For more on testing workflows, see the related questions about Cloud Staging and Regression Tests. Visit apifyforge.com/tools/test-runner for documentation and examples.

Related questions