Testing Extensions on a Local Server in NetSuite
Test your extensions on a local server before deployment with Gulp.js, ensuring seamless integration and functionality.
You can test your extension customizations on a local server before deploying to NetSuite. This local server is installed as part of the Node.js setup and utilizes the Express web framework.
Setting Up Your Local Server
To start testing your extension locally, execute the following command in your terminal:
gulp extension:localThis command compiles all source files and places them into the combined files located within the LocalDistribution/tmp directory. When the server starts, Gulp.js initializes watch tasks that monitor changes made to your files, such as JavaScript, Templates, or Sass directories. As you save changes, Gulp automatically recompiles the necessary files and updates the LocalDistribution directory, while also notifying you in the console of any changes.
Important: Typically, you should test your code locally before deployment to a live NetSuite account. However, if your extension includes SuiteScript or configuration files (JSON), you must deploy these files to your account and activate the extension for local server access to them. Services added through SuiteScript won’t be available in your account's backend until deployed, and changes to configuration JSON files require deployment to apply.
Steps to Test Your Extension
Follow these steps to test your extension on a local server:
-
Fetch the Active Theme: Ensure you fetch the active theme before testing your extension. This is crucial for proper functionality. Refer to the Fetch Active Theme and Extension Files for detailed instructions.
-
Open Command Line: Access the top-level development directory created after extracting the Extension Developer Tools.
-
Run Gulp Command: Execute:
bashgulp extension:localThis initializes your local server and compiles your source files for the first time, creating a
LocalDistributionsubdirectory if it doesn't already exist.Warning: Running
gulp extension:localwill overwrite yourmanifest.jsonfile with default changes. To avoid data loss, use the command:bashgulp extension:local --preserve-manifest…to keep your manual modifications intact.
-
Access Local Application: Navigate to your local application using one of the following URL patterns, ensuring you replace placeholders appropriately:
-
Shopping:
http://<_DOMAIN_NAME_>/c.<_ACCOUNT_ID_>/<_SSP_APPLICATION_>/shopping-local.ssp -
My Account:
http://<_DOMAIN_NAME_>/c.<_ACCOUNT_ID_>/_SSP_APPLICATION_/my_account-local.ssp -
Checkout:
http://<_DOMAIN_NAME_>/c.<_ACCOUNT_ID_>/_SSP_APPLICATION_/checkout-local.ssp -
Example for SuiteCommerce:
http://www.mysite.com/c.123456/scs/shopping-local.ssp
-
Example for SuiteCommerce Advanced:
http://www.mysite.com/c.123456/sca-dev-aconcagua/shopping-local.ssp
-
Note: For secure HTTPS checkout access, refer to Secure HTTP (HTTPS) with the Local Server for specifics.
Conclusion
By following these steps, you can effectively test and debug your extension on a local server, ensuring that it functions correctly before deploying it to a live environment. Always be mindful of potential data loss when updating manifest files.
Key Takeaways
- Test extensions locally to validate functionality before deployment.
- Use Gulp.js to compile and manage code changes effectively.
- Ensure you fetch the active theme and deploy your extension correctly to access all features.
Frequently Asked Questions (4)
What command should I use to test my NetSuite extension locally?
How can I preserve manual changes in my manifest.json file when testing locally?
Do I need to deploy SuiteScript files to test them locally?
What is important to do before testing an extension locally on NetSuite?
Was this article helpful?
More in Commerce
- SuiteCommerce CAPTCHA Configuration Options and Setup
Configure SuiteCommerce CAPTCHA for enhanced security. Enable CAPTCHA for registration, login, guest checkout, and orders.
- Single Sign-On Integration for NetSuite Web Stores
Implement inbound single sign-on integration for NetSuite web stores using SAML or OpenID Connect for seamless access.
- Facets Management for Commerce in NetSuite
Facets management in NetSuite Commerce optimizes item search filters, enhancing performance and improving user experience.
- SuiteCommerce Analytics Data and Cookie Consent Integration
SuiteCommerce Analytics Data enables tracking of shopper behavior. This requires a cookie consent extension for user preferences.
Advertising
Reach Commerce Professionals
Put your product in front of NetSuite experts who work with Commerce every day.
Sponsor This Category