This lab was about how to create a test plan for the static website generator. First I need to choose which testing framework that I am going to use. I chose jest framework because it seems easy in the professor's lectures. This is a testing framework for node.js. It helps us to test from units to end-to-end testing.
And below is the steps to implement a testing script to the program.
First, I download the jest framework using npm.
npm i jest
Second, I added, "test": "jest" to the script in package.json file.
"scripts": {
"test": "jest"
},
After that, I created a test.js file for each of the javascript files that needed to test in the same folder of the javascript file. For example,
cli.js => cli.test.js
Finally, I created a testing plan for the test plan.
First of all, I created a testing plan for all the possible user inputs. I was quite impressed while I am creating the test cases. This is because, previously, I tested manually all the features that I added to the program and all the edge cases. And I need to test again most of the features if I add a feature, just in case if the added feature can affect other existing functions.
After that, I created unit test cases for converting from the text and markdown file to HTML files. It was also impressive because to test the single function I need to debug with the IDE that I am using or I put the console.log to make sure it runs properly. But as these unit test cases that I create will test all the needed functions, I think it will save lots of my time.
As creating testing plan, save lots of my manual testing time. From now on, I think I am going to use this framework to test the features of the program that I will create.
Top comments (0)