Taking a detour to explore what testing really means

Tony Vu
2 min readOct 28, 2020

--

Long story short, I continue working on my release 0.2 third PR after successfully contributing the first two to Telescope. I would like to learn more about testing a program for the third PR because testing is a significant topic in software development.

I came across a repo called run.env by working with Telescope as we made use of the repo’s function to read environmental variable without installing dotenv package. Initially, I thought there could be some bug in the package that prevents releasing process of Telescope from a Windows machine. However, after exploring and learning how to run the program locally, I realized that it was a bug in somewhere else. Quite a disappointment I would say! I was thinking maybe I could fix the bug and use it as my third PR. All is not loss though. I also realized that despite of its simplicity, the repo has no test module that ensure the correctness of its running. Hence, I decided to provide a test scenario for it.

What I did was to add a test app, an .env file for test and a test script. When developers run npm run test, node will try to build the executable binary of the program then minic the process of how it would run if it was installed as a dependency. The result of the test should show the content of environmental variable in the .env file which is “This is the content of TEST variable” and “No value for process.env.NON_EXISTING_VAR”. The second one was to see how the program deal with environmental variables that do not exist.

It is probably the easiest test module that you could ever write but I believe everything should have started from the basics. I have learned many from exploring the repo and thinking about a way to test it rather than using a test engine like Jest. I have also learned that no matter how small your projects are, having it tested is very important.

This is a short blog as there is not much to write about. Thank you for reading!

Tony Vu.

--

--

No responses yet