Package Test
Unit Tests of the install, uninstall, update, and search packages methods.
Summary
The Package unit tests are made to ensure the new features implemented by developers are running in an expected state, so that optimistically the next release of Drop can be bug free.
Note: Every develop on Drop development need to run through the tests before merging the new features to the Production environment!
The unit tests require the developers to manually spin up the frontend and backend servers as well as adjusting some parameters in the Drop desktop project. Follow the next section How to start the unit tests
to learn how to set it up.
How to start the unit tests?
The unit tests have its own MongoDB database and S3 bucket - Make sure to coordinate with the team lead to learn more information.
Setup Frontend
Find the the
environment.ts
file under thesrc/environments
folder[To be merged into Main] Make sure to add
Base_URL: "http://localhost:3017"
in theenvironment variable
Comment out the rest of the BASE_URLs. This tells the frontend to look at the local backend server that connects to the testing database.
Type
ng serve
to run the backend testing local server.
Setup Backend
Find and open
keys.js
under thekeys
folder.[To be merged into Main] Add the line
else if (process.env.NODE_ENV == "test") { console.log("Running in test environment...!"); module.exports = require("./test.keys"); }
before the else condition.[To be merged into Main] Create a javascript file named
test.keys.js
under thekeys
folder.[To be merged into Main] Add the necessary S3 and AWS credentials in this file, and point the Base_URL to the
[To be merged into Main] Add this test:
command for starting the test backend server in the
package.json
Open the Command Prompt at the root directory of the Backend project.
Type
npm run windows:test
to run the backend testing local server.
Setup Desktop
Find the
DropSettings.json
under theCORE.Drop.Library
project.Add the lines in the
packageRepos
list:{ "type": "URL", "url": "http://localhost:3017", "name": "Drop Localhost", "enabled": true }
Turn the enabled for the current active repo to
false
, make sure localhost:3017 is the only repo istrue
.If you follow all the steps above, you are ready to go with the unit tests.
Find the
Test
folder directly under the CORE.Drop.Desktop solution.Finally, Run CORE.Packaging.Test unit test project.
Where are the testing packages?
[To be merged into Main] The source folder of the testing packages is located in your local repo folder - CORE.Drop.Desktop\sample\TestCases
When the unit tests are initiated, each test will try to install the packages from the testing packages source folder to the %userprofile%/.core-drop
folder, make sure to uninstall all the packages that you installed previously from Drop to keep the .core-drop folder clean before the tests.
Last updated