> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenderly.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Local Development और Testing

> Web3 Action code पर तेज़ी से iteration प्राप्त करें और @tenderly/actions-test का उपयोग करके अपने action functions के लिए automated tests लिखें।

अपने [Web3 Action](/monitoring/web3-actions/introduction) code के local development को सुविधाजनक बनाने के लिए, आप **@tenderly/actions-test** package (tenderly-actions में शामिल) का उपयोग कर सकते हैं। यह एक Tenderly runtime उजागर करता है, ताकि आप अपने local environment में अपनी Web3 Action को execute और शायद test कर सकें।

अपने Web3 Action functions को locally test करने के लिए [**@tenderly/actions-test**](https://github.com/Tenderly/tenderly-actions/tree/main/packages/actions-test) package स्थापित करें।

```bash title="example" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
yarn add --dev @tenderly/actions-test
```

<Note>
  web3-actions project के size को बढ़ाने से बचने के लिए, web3-actions के लिए tests और run scripts को *actions root* directory के बाहर रखने की सिफारिश की जाती है।
</Note>

आप **@tenderly/actions-test** का उपयोग अपने development process का समर्थन करने के लिए दो तरीकों से कर सकते हैं:

* इसे अपने automated tests के भीतर उपयोग करें (**अनुशंसित**)।
* JavaScript/TypeScript में एक run script बनाएँ।

### अपने tests में @tenderly/actions-test का उपयोग करना

अपने tests में **@tenderly/actions-test** का उपयोग करने के लिए, कोई अतिरिक्त चरणों की आवश्यकता नहीं है। अपनी Web3 Action का परीक्षण करने और परिणामों को assert करने के लिए आवश्यक `TestRuntime` और events को import करें।

निम्नलिखित उदाहरण दिखाते हैं कि package का उपयोग Web3 Action को invoke करने और Action functions जो event object की अपेक्षा करती हैं उसे पास करने के लिए कैसे किया जाए। आप जिन event types को पास कर सकते हैं, उनके विवरण के लिए, [functions, events, और triggers](/monitoring/web3-actions/references/functions-events-triggers) देखें।

### एक कार्यशील उदाहरण

multisig wallet उदाहरण और इसका उपयोग यह करने के तरीके को देखें कि **@tenderly/actions-test** का उपयोग locally action function चलाने के लिए कैसे किया जाता है।

<Card title="Running the  action function locally" href="" />

### उदाहरण: एक script के भीतर Action function चलाना

निम्न उदाहरण **src/web3-actions-local/run.ts** पर एक file दिखाता है जो तीन actions चलाती है, उपयुक्त events पास करते हुए। ध्यान दें कि Web3 Actions source file (`src/actions/awesomeActions.ts`) script वाली directory के sibling में है:

#### चरण 1: run script लिखें

```tsx title="example.tsx" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
// File: src/web3-actions-local/run.ts
// web3-actions sources location: src/actions/awesomeActions.ts


/*
 * Running Web3 Actions code locally.
 * TestRuntime is a helper class that allows you to run the functions,
 * and set storage and secrets before running the function
 **/
const main = async () => {
  const testRuntime = new TestRuntime();

  testRuntime.context.secrets.put('multisig.DISCORD_URL', process.env.DISCORD_URL || '');

  await testRuntime.execute(everyDay, new TestPeriodicEvent());

  await testRuntime.execute(whenDappPosts, new TestWebhookEvent({ foo: 'bar' }));

  const te = new TestTransactionEvent();
  te.to = '0x1a22...';
  te.from = '0xc023...';

  await testRuntime.execute(onTxEvent, new TransactionEvent());
};

(async () => await main())();
```

#### चरण 2: enclosing project के package.json में scripts का विस्तार करें।

आप इस script को अपनी **package.json** file में जोड़ सकते हैं।

```diff title="example" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
    ...
  "scripts": {
    ...
+   "local-w3a-run": "ts-node src/web3-actions-local/run.ts"
    ...
  }
  ...
}
```

#### चरण 3: script चलाएँ

```bash title="example" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
yarn local-w3a-run
```
