Posts

Showing posts with the label Unit Testing

What are Unit Tests and Why Should You Write Them?

Image
  Unit tests are simple scripts that check whether a given unit—class, function, module, etc. is working as expected.  They are meant to be simple, to cover the happy path of the code plus a few edge cases. They contribute to the long-term success of a project because of the reasons I discuss below.  As your code grows in size and complexity, tests will force you to break it into manageable pieces. Tests will become an additional resource for the next person working the code to figure out what it’s doing. As a junior programmer, you might be confused by unit tests. To make things worse, tests used as examples often make their purpose more unclear. When you see stuff like you are right to doubt whether there is a solid reason to spend any time writing them. Below, I show my reasons for writing unit tests. # What are unit tests? Unit tests are simple scripts that check whether a given unit—class, function, module, etc.—is working as expected. They are meant to be rather simple, to cover

Software Testing

Image
UNIT TESTING   is a level of software testing where individual units/ components of a software are tested. The purpose is to validate that each unit of the software performs as designed. A unit is the smallest testable part of any software. It usually has one or a few inputs and usually a single output. In procedural programming, a unit may be an individual program, function, procedure, etc. In object-oriented programming, the smallest unit is a method, which may belong to a base/ super class, abstract class or derived/ child class. (Some treat a module of an application as a unit. This is to be discouraged as there will probably be many individual units within that module.) Unit testing frameworks, drivers, stubs, and mock/ fake objects are used to assist in unit testing. Definition by ISTQB unit testing:  See  component testing. component testing:  The testing of individual software components. Unit Testing Method It is performed by using the  White Box Testing  meth