Suite Script Unit Test

  • Should the script be deployed to All Users/Subsidiaries/Roles/Departments/Contexts?
  • Should the permission level be Current Role/Admin/Specific Roles?
  • Should there be empty/unnecessary entry points on the script?
  • Does the User Preference have an impact on the customization?

For example: User Date Preference is different from company preference.

The date format can be changed on the user preferences and the script should consider such variations into account.

  • When setting a value to the reference field (List/Record) or Date field, always try to set it by setValue rather than setText.

For example: An account name can be changed, or setting can be changed to show/hide parent hierarchy. But internal Id stays the same.

There are instances where setText is more appropriate.

For example: When the custom List is static such as Country, when the reference follows a common rule etc.

  • Reference Path: Try to maintain a relative reference path for custom Module/script rather than an absolute path.
  • Is there a possibility for the governance (usage) to exceed the limit.
  • Is there a possibility for the execution time to exceed the limit.
  • If there are multiple saved searches, can some of them be combined to optimize the time/speed of execution?
  • Are there unnecessary logs on the script? Is proper log level utilized?

For example: Script is deployed in one log level and the log level defined in the script is another.

To log errors, using log.error rather than log.debug etc.

  • Does the new customization have taken into account the impact it has on existing customization, or the impact existing customization have on it. For example: Lock record will restrict the load action of a record in other scripts. This will cause the failure of other scripts.
  • What is the degree of the performance hit on the system due to the current customization and is there any way we can fix/mitigate the same. Does the record already have a multitude of customizations deployed?
  • Is the usage of the NetSuite SuiteScript module/function parameters are properly taken into account as per the requirement. Most of them are using default values for the optional parameters.

For example: ignoreFieldChange and forceSyncSourcing in record.setSublistValue

  • Are the API credentials of Integration/SFTP are being properly resolved dynamically based on NetSuite environment. Will sandbox refresh (or Release Preview) cause the production script to run in Sandbox and invoke the API with production API credentials.
  • If dealing with Date, is the Date Time is properly resolved based on the time zone a desired.

Leave a comment

Your email address will not be published. Required fields are marked *