-
Notifications
You must be signed in to change notification settings - Fork 148
Testing
The following document describes the process which you need to go through in order to complete the testing process.
- Unit Testing Phase
- Integration Testing Phase
- End to End Testing Phase
- Usability Testing Phase
- Libraries and modules are written and implemented, whereafter tests need to be written by the involved developer(s).
- Upon completed implementation and written tests, the tester will review the modules and libraries and determine whether the tests are adequate or if more tests are needed, also providing Quality Assurance.
- Once reviewed and the tests are proper and complete, the tester will log the results of each test using the protocol defined on the next page.
- No module or library may leave the current phase or be pushed until a tester has reviewed and logged the results for the test.
- Testers will coordinate to effectively test the system’s features from start to end, ensuring the expected functionality is achieved.
- More details on steps to follow in next Sprints.
- Testers will coordinate to test the UI and feel of the system, ensuring it delivers aesthetical as well as functional quality and testing the system’s usability.
- More details on steps to follow in next Sprints.
Naming
The log files should be named as follows: PR followed by the PR number, e.g., for PR#91, the log name would be PR91.
Format:
PR Number: 91
Commit Hash: 42eeff
Status: Passed/Failed
Date: yyyy/mm/dd
Tester(s): Bob Ross, Ben Stiller
Developer(s): Timbur Lee
Description: Commit Title if passed and Error explanation if failed (short)
6.1. Pass:
- Log the test with the given format.
- Move the segment to the next phase if applicable.
6.2. Fail:
- Log the test with the given format.
- Open a GitHub Issue with the same format and titled “Failed Test:”.
- Notify the involved developer(s).
- Await valid and passed test results then close the GitHub Issue (only allowed by testers).
- Follow “Pass” step
Testing is done without dependencies on individual modules within the team’s environment.
Test interactions and dependencies between modules and libraries, prioritize the parts only dependent within your own team’s feature, then move toward testing integration with modules/libraries outside of your features. Communicate with the other teams’ testers.
Tests are run from start to end to ensure the program behaves as expected. Thus this would be a “completed” part of the program that needs to have its functionality checked. The testers will need to coordinate with each other on this.
Jest is the testing framework that will be used in Phase 1 and 2 during the testing phase described above. Jest is a JavaScript testing framework maintained by Meta, designed with a focus on simplicity and support for large web applications. It works with projects using Babel, TypeScript, Node.js, React, Angular, and more…
First you need to install JavaScript. The majority of the coding will be done in TypeScript but for this example I will be using NodeJS.
Install NodeJS on your device from https://nodejs.org/en/download/ Install VSCode on your device from https://code.visualstudio.com/download
(win10) Open CMD and running the following commands to make sure that everything is installed correctly, you should get a version number after you run the command:
node --version
npm --version
Open VSCode and Install the following extensions:
JavaScript (ES6) by charalampos karypidis
Code Runner by Jun Han
Restart your computer and now you should be ready to run JavaScript programs. The following Youtube video was used as reference, if you struggle refer to this link : https://www.youtube.com/watch?v=x_2sYpk75Ic&t=350s
While in VSCode, open a folder and a new terminal
In the terminal, write: npm init -y
This will create a package.json
file and serve as the starting point.
Next in the terminal, write: npm i --save-dev jest
This will now download and install jest.
After this has downloaded, go to the package.json
file and change the “test” variable to “Jest”
The package.json file should look like this if all was done correctly.
{
"name": "jest",
"version": "1.0.0",
"description": "",
"main": "sum.js",
"scripts": {
"test": "jest"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"jest": "^27.5.1"
}
}
Create a file called sum.js
and in it write the following code:
function sum(a, b) {
return a + b;
}
module.exports = sum;
next create a file called sum.test.js
and in it write the following code:
const sum = require('./sum');
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3);
});
And then finally. In the terminal. Write the following: npm run test
This will run the test and test if the code has passed or failed! It will look something like this:
PS D:\Tuks\2022\COS 301\Mini Project\Jest> npm run test
> [email protected] test
> jest
PASS ./sum.test.js
√ adds 1 + 2 to equal 3 (2 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.568 s
Ran all test suites.
The following YouTube video was used as reference, great to follow and shows a lot more about jest: https://www.youtube.com/watch?v=FgnxcUQ5vho&t=99s
This is however a very brief summary and there is a lot more to testing! Go to the documentation of Jest here: https://jestjs.io/docs/getting-started