Enthusiasts always want to explore & learn new stuffs. They don’t want themselves to get stuck on just one technology. So, in March 2017, community organized a meetup on Unit Testing, which was of course a new stuff for attendees & they were excited to explore it, just like everytime. This meetup was mainly oragnized by WTM Baroda which is a part of GDG Baroda. In this meetup, attendees were going to learn something interesting.

In this meetup, speaker was Praful Prajapati, Associate Senior Engineer, Mastercard. He introduced us to the Unit Testing. So, in computer programming, unit testing is a software testing method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine whether they are fit for use. Intuitively, one can view a unit as the smallest testable part of an application. In procedural programming, a unit could be an entire module, but it is more commonly an individual function or procedure. The objective in unit testing is to isolate a unit and validate its correctness.

Hands-on session for unit testing

Why Unit Testing?

Praful made the attendees to get hands-on for unit testing. He shown us how unit testing helps in increasing efficiency of code. Unit testing finds problems early in the development cycle. This includes both bugs in the programmer’s implementation and flaws or missing parts of the specification for the unit. The process of writing a thorough set of tests forces the author to think through inputs, outputs, and error conditions, and thus more crisply define the unit’s desired behavior. The cost of finding a bug before coding begins or when the code is first written is considerably lower than the cost of detecting, identifying, and correcting the bug later; bugs may also cause problems for the end-users of the software. Code can be impossible or difficult to test if poorly written, thus unit testing can force developers to structure functions and objects in better ways.

Advantages of Unit Testing

Unit testing allows the programmer to refactor code or upgrade system libraries at a later date, and make sure the module still works correctly (e.g., in regression testing). The procedure is to write test cases for all functions and methods so that whenever a change causes a fault, it can be quickly identified. Unit tests detect changes which may break a design contract. When software is developed using a test-driven approach, the combination of writing the unit test to specify the interface plus the refactoring activities performed after the test has passed, may take the place of formal design. Each unit test can be seen as a design element specifying classes, methods, and observable behaviour.

Attendees enjoyed this meetup like anything!

Being with GDG Baroda, is always a great thing!

That’s it for today’s post. We’ll continue our journey in upcoming post.