Create Custom Methods in VS Code
After connecting your repository, follow the steps below to create and configure your Custom Method.
The WalnutAI VS Code extension allows you to seamlessly create, debug, sync, and manage Custom Methods directly from Visual Studio Code. Follow the steps below to set up the extension, create your Custom Method, and make it available for use in your WalnutAI tests.
Steps to Create a Custom Method:
Open VS Code and navigate to the Extensions panel.

Search for WalnutAI in the search bar and click Install.

Once the WalnutAI icon appears in the sidebar, click on it and log in to your WalnutAI account.

After logging in, open a folder where you want to work with your Custom Methods.

Select the required project from the dropdown.

Once the project is selected, switch the tab to QA and click Install Playwright MCP.

After installing Playwright MCP, click Methods to view the repository connected under it.

Once done, open and initialize the repository.

Click Create Method and enter a prompt describing the Custom Method you want to create. For example, you can enter a prompt such as “Generate an employee ID starting with S, followed by four digits.”

Once you send the prompt, WalnutAI generates a code file for the Custom Method based on the prompt you provided.

Click Sync to sync the created Custom Method with the WalnutAI frontend.

In WalnutAI, navigate to Admin Settings and open Custom Settings.

Switch to the Custom Methods tab, locate the method you created, and if it is not synced, click Sync Actions.

Once the method is synced, set breakpoints in VS Code, and Enable Debug Mode in VS Code.

Add the created Custom Method to the required test case by typing / in the test step and select Actions.

From the Actions dropdown, select the created Custom Method and replace the required parameters.

Click Debug in the WalnutAI to debug the Custom Method and validate that it is working as expected.

Click Push if you want to push the created Custom Method and your latest changes to the repository, making them accessible to your teammates as well.

Click Pull to retrieve the latest changes from the Git repository.

Last updated

