Test runner - Mocha
Request lib - Got
Assertions - Chai
- Install NodeJS - LTS version is preferable
- Clone the repository
- Locate to the project folder and install dependencies. -
npm install
- To be able to run the
npm run allure-report
command, download the Java JDK from here, install it, and set the JAVA_HOME Environment Variable:- Open Windows Search, type in “env”, and choose “Edit the system environment variables”.
- Click on "Environment Variables..." -> "New" (under the system variables)
- Fill in the "Variable name" field with "JAVA_HOME" and fill in the "Variable value" with the path to where Java is installed on your computer. (For me it is under "C:\Program Files\Java<jdkversion>")
- Click "OK" and close all dialogs.
- Restart your IDE / Terminal (Do not skip this step!)
- Run the script command from the
package.json
(e.g.npm run api:tests
)
├───tests
├───api
│ ├───config
│ ├───lib
│ │ ├───controllers
│ │ │ | ├───<functionality-name>.controller.ts
│ │ │ | ├───...
│ │ │ ├───request.ts
│ │───specs
│ │ ├───<functionality-name>
│ │ | ├───data
│ │ | ├───..._api-test.ts
│ │ ├───...
├───helpers
├───...
- scripts - bash scripts, js modules for particular job to be done.
- tests/api - test root folder with project folders.
- tests/helpers - helpers to use across the tests
- api/config - directory with configs to run tests depends on env
- api/lib - all controllers, request builder and other important files are in here
- api/specs - put your tests here inside corresponding folder