
























@@ -29,8 +29,12 @@ plugins.
29293030**Plugin contract import:** `openclaw/plugin-sdk/plugin-test-contracts`
313132+**Plugin runtime test import:** `openclaw/plugin-sdk/plugin-test-runtime`
33+3234**Provider contract import:** `openclaw/plugin-sdk/provider-test-contracts`
333536+**Environment/network test import:** `openclaw/plugin-sdk/test-env`
37+3438The testing subpath exports a narrow set of helpers for plugin authors:
35393640```typescript
@@ -43,7 +47,9 @@ import { createTestPluginApi } from "openclaw/plugin-sdk/plugin-test-api";
4347import { expectChannelInboundContextContract } from "openclaw/plugin-sdk/channel-contract-testing";
4448import { createStartAccountContext } from "openclaw/plugin-sdk/channel-test-helpers";
4549import { describePluginRegistrationContract } from "openclaw/plugin-sdk/plugin-test-contracts";
50+import { registerSingleProviderPlugin } from "openclaw/plugin-sdk/plugin-test-runtime";
4651import { describeOpenAIProviderRuntimeContract } from "openclaw/plugin-sdk/provider-test-contracts";
52+import { withEnv, withFetchPreconnect } from "openclaw/plugin-sdk/test-env";
4753```
48544955### Available exports
@@ -55,32 +61,32 @@ import { describeOpenAIProviderRuntimeContract } from "openclaw/plugin-sdk/provi
5561| `installChannelOutboundPayloadContractSuite` | Install channel outbound payload contract cases. Import from `plugin-sdk/channel-contract-testing` |
5662| `createStartAccountContext` | Build channel account lifecycle contexts. Import from `plugin-sdk/channel-test-helpers` |
5763| `describePluginRegistrationContract` | Install plugin registration contract checks. Import from `plugin-sdk/plugin-test-contracts` |
64+| `registerSingleProviderPlugin` | Register one provider plugin in loader smoke tests. Import from `plugin-sdk/plugin-test-runtime` |
65+| `registerProviderPlugin` | Capture all provider kinds from one plugin. Import from `plugin-sdk/plugin-test-runtime` |
66+| `registerProviderPlugins` | Capture provider registrations across multiple plugins. Import from `plugin-sdk/plugin-test-runtime` |
67+| `requireRegisteredProvider` | Assert that a provider collection contains an id. Import from `plugin-sdk/plugin-test-runtime` |
68+| `createRuntimeEnv` | Build a mocked CLI/plugin runtime environment. Import from `plugin-sdk/plugin-test-runtime` |
69+| `createPluginSetupWizardStatus` | Build setup status helpers for channel plugins. Import from `plugin-sdk/plugin-test-runtime` |
5870| `describeOpenAIProviderRuntimeContract` | Install provider-family runtime contract checks. Import from `plugin-sdk/provider-test-contracts` |
5971| `installCommonResolveTargetErrorCases` | Shared test cases for target resolution error handling |
6072| `shouldAckReaction` | Check whether a channel should add an ack reaction |
6173| `removeAckReactionAfterReply` | Remove ack reaction after reply delivery |
6274| `createTestRegistry` | Build a channel plugin registry fixture |
6375| `createEmptyPluginRegistry` | Build an empty plugin registry fixture |
6476| `setActivePluginRegistry` | Install a registry fixture for plugin runtime tests |
65-| `createRequestCaptureJsonFetch` | Capture JSON fetch requests in media helper tests |
66-| `withFetchPreconnect` | Run fetch tests with preconnect hooks installed |
67-| `withEnv` / `withEnvAsync` | Temporarily patch environment variables |
68-| `createTempHomeEnv` / `withTempDir` | Create isolated filesystem test fixtures |
69-| `createMockServerResponse` | Create a minimal HTTP server response mock |
70-| `registerSingleProviderPlugin` | Register one provider plugin in loader smoke tests |
71-| `registerProviderPlugin` | Capture all provider kinds from one plugin |
72-| `registerProviderPlugins` | Capture provider registrations across multiple plugins |
73-| `requireRegisteredProvider` | Assert that a provider collection contains an id |
77+| `createRequestCaptureJsonFetch` | Capture JSON fetch requests in media helper tests. Import from `plugin-sdk/test-env` |
78+| `withFetchPreconnect` | Run fetch tests with preconnect hooks installed. Import from `plugin-sdk/test-env` |
79+| `withEnv` / `withEnvAsync` | Temporarily patch environment variables. Import from `plugin-sdk/test-env` |
80+| `createTempHomeEnv` / `withTempDir` | Create isolated filesystem test fixtures. Import from `plugin-sdk/test-env` |
81+| `createMockServerResponse` | Create a minimal HTTP server response mock. Import from `plugin-sdk/test-env` |
7482| `runProviderCatalog` | Execute a provider catalog hook with test dependencies |
7583| `resolveProviderWizardOptions` | Resolve provider setup wizard choices in contract tests |
7684| `resolveProviderModelPickerEntries` | Resolve provider model-picker entries in contract tests |
7785| `buildProviderPluginMethodChoice` | Build provider wizard choice ids for assertions |
7886| `setProviderWizardProvidersResolverForTest` | Inject provider wizard providers for isolated tests |
7987| `createProviderUsageFetch` | Build provider usage fetch fixtures |
80-| `useFrozenTime` / `useRealTime` | Freeze and restore timers for time-sensitive tests |
81-| `createRuntimeEnv` | Build a mocked CLI/plugin runtime environment |
88+| `useFrozenTime` / `useRealTime` | Freeze and restore timers for time-sensitive tests. Import from `plugin-sdk/test-env` |
8289| `createTestWizardPrompter` | Build a mocked setup wizard prompter |
83-| `createPluginSetupWizardStatus` | Build setup status helpers for channel plugins |
8490| `createRuntimeTaskFlow` | Create isolated runtime task-flow state |
8591| `typedCases` | Preserve literal types for table-driven tests |
8692@@ -90,9 +96,9 @@ suites that depend on bundled OpenClaw inventory stay under `src/plugins/contrac
9096Keep new extension tests on `openclaw/plugin-sdk/testing` or a narrower
9197documented SDK subpath such as `plugin-sdk/plugin-test-api` or
9298`plugin-sdk/channel-contract-testing`, `plugin-sdk/channel-test-helpers`,
93-`plugin-sdk/plugin-test-contracts`, or `plugin-sdk/provider-test-contracts`
94-rather than importing repo `src/**` files or repo `test/helpers/plugins/*`
95-bridges directly.
99+`plugin-sdk/plugin-test-contracts`, `plugin-sdk/plugin-test-runtime`,
100+`plugin-sdk/provider-test-contracts`, or `plugin-sdk/test-env` rather than
101+importing repo `src/**` files or repo `test/helpers/plugins/*` bridges directly.
9610297103### Types
98104此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。