File Parser — what is it & what are the possible test scenarios?

Team Merlin
Government Digital Services, Singapore
3 min readJul 5, 2024

A file parser analyses and extracts data from a file, and converts into a format that is usable by an application.

Let’s take a look at a simple scenario to illustrate how a file parser may be necessary, and what are the few possible testing scenarios for it:

A bookstore wanted to get books from a book publishing company to be sold on their online platform. The book publishing company can provide a data file of a list of books with information that are/will be published by them.

The sample data file, which resides in a folder of another location, is as follows:

Here is the database design of the bookstore:

With the above, we have identified two issues:

  1. the data is unstructured, which makes it difficult to read
  2. the bookstore doesn’t require all the information in the file

This is where a file parser comes into the picture!

Now, let’s take a look at the possible test scenarios to be covered.

A data file can either be transferred over a network or retrieved locally, and there may be multiple data files to be sent/received on a daily basis. So where and how should we store these data files? How do we check that the data file received is valid? And how can we indicate which data file(s) is/are the latest version(s)?

Here’s an example of the information to illustrate the data file:

Assuming the file parser will get executed whenever there is a new data file available, the possible test scenarios based on the above information can be:

Now that we have the data file, what’s next?

Before implementing anything, it’ll be good to have a few actual/sample files to know how the actual records look like. We can, then, extract and process the data according to what we need and is available.

Based on the sample data file above, the records will need to be extracted and processed to fit the database design of the bookstore. Let’s take a look at how the records will look like after the execution of the file parser.

After the completion of the file parser, verifications of the records are necessary to ensure that the data is extracted and processed correctly.

Other than verification of the records, do include the following test scenarios as well:

We hope this article can help you understand the basics of the file parser and the possible test scenarios you can add to your existing functional test scenarios. Feel free to share with us your experiences in file parser too!

🧙🏼‍♀ Team Merlin 💛
Application security is not any individual’s problem but a shared responsibility.

--

--