Adding More Tests

My school’s telescope project is coming along quite nicely. Although I didn’t contribute too much to the project, it’s still nice to see a working iteration now. Last time I worked on the summarizer functionality and its tests. After looking over the available issues, I decided to implement more test cases for existing functionality. Specifically, I worked on the tests for the wiki-feed-parser.

Implementing the test-cases for someone else’s work was pretty simple. I looked at the implementation and then tried to cover as many of the use cases for the functionality. This was made even easier now that jest provides a table of the code coverage for the tests so I have a rough idea if I touched all the edge cases in term of line coverage. However, I really think the person who implements a function should also implement their own test-cases or just follow test driven development.

Something I ran into that made me hesitate was when I was creating test cases for error handling. The project does not seem to have a standard for error handling and their messages so I was not sure about the expected thrown error. The error I got while testing a missing <pre> tag was whatever was thrown up the stack; it was handled explicitly. Not sure if thats the best practice but I just put a note on the PR and had the test past with the currently thrown error.

Test development is pretty fun; I learn by reading other people’s code and then try my best to break it. It’s like the releasing the urge to smash snowmen as a kid during winter. The semester is coming to an end but before this week ends, I hope to push the test coverage to 100% of line coverage on jest. Hopefully I will have enough time after my assignments to do so.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website at WordPress.com
Get started
%d bloggers like this: