Step One: Setup Your IDE for Unit Testing
The following steps show how to set up and configure your Visual Studio Code for unit testing. For additional help, see SuiteCloud Unit Testing.
-
Install Visual Studio Code – Follow the steps on SuiteCloud Extension for Visual Studio Code Overview for information about how to install and set up your development environment. When your SuiteCloud project is created, you must install the unit testing software.
-
Install Unit testing for SuiteCloud – For information about how to configure your SuiteCloud project for unit testing, see SuiteCloud Unit Testing.
Complete Project Structure
When you have set up your SuiteCloud project in Visual Studio, you are ready to begin writing unit tests. The following list provides details on each file in your project. For more information about SuiteCloud project structure, see SuiteCloud Project Structure and File Components.
-
A src (source) folder that contains account configuration, SuiteScript file cabinet, and other SuiteCloud project dependencies.
-
A __tests__ (unit tests) folder that contains the unit test files that correspond to each SuiteScript in your project.
-
A jest.config.js configuration file that contains project information, such as custom stub naming conventions and file paths.
-
A package.json file that contains project information, such as Jest and SuiteCloud dependencies.
Note that the following files are automatically generated in your project folder:
-
A package-lock.json file
-
A coverage folder that contains code coverage details for your test file. This folder will appear if code coverage is configured in the jest.config.js file when you execute the
npm test
command in the embedded terminal. -
A node_modules folder