Integration test harness

Last updated Jul 27, 2026 is a Wrangler API for integration testing from any Node.js test runner. It runs one or more Workers from Wrangler projects or Vite projects that use the Cloudflare Vite plugin.

Get started View complete example

Features

  • Runs production build output from Wrangler or the Cloudflare Vite plugin
  • Dispatches requests and events to one or more Workers
  • Provides access to bindings and local storage from tests
  • Captures logs and diagnostic output from the Workers runtime

Guides

Configure the test harness

Configure Workers, test values, lifecycle hooks, and failure diagnostics.

Prepare test state

Seed storage, mock outbound requests, and replace bindings.

Interact with Workers

Test routes, dispatch events, control Workflows, and assert logs.

Integrations

Use the test harness with MSW and Playwright.

Was this helpful?

YesNo

On this page

Integration test harness - 图1Docs

{"@context":"https://schema.org","@type":"WebPage","@id":"https://developers.cloudflare.com/workers/testing/test-harness/#page","headline":"Integration test harness","description":"Write integration tests for Cloudflare Workers with the createTestHarness API in Wrangler.","url":"https://developers.cloudflare.com/workers/testing/test-harness/","inLanguage":"en","image":"https://developers.cloudflare.com/workers/testing/test-harness/og.png?v=5e0eaafcab8795f3","dateModified":"2026-07-27","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Configure Workers, test values, and lifecycle options for createTestHarness. title: Configure the test harness image: https://developers.cloudflare.com/workers/testing/test-harness/configure/og.png?v=402b3cbc702b26b0


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/workers/llms.txt
Use this file to discover all available pages before exploring further.