Contents


Name of Skill Classification of Skill Prerequisites for Skill Related Software Engineering Areas(s) Rationale for Skill Roles for Skill Work Related To Skill Real World Example Role of Academia/Industry Tools supporting the skill Skill Self Assessment References



Name of Skill

Writing Unit Tests
Unit Testing is a type of software testing where individual units or components of a software are tested. The purpose is to validate that each unit of the software code performs as expected.


Classification of Skill

Unit testing is a technical skill; a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation.

Unit Testing can be done in two ways:

  1. Manual Unit Testing
    In Manual Unit testing, the tester checks all the essential features of the method, function or procedure, i.e., execution of test cases without the help of any automated software/ testing tools.
  2. Automated Unit Testing
    In automated unit testing, the testers use automation tools to write the scripts and validate the features of the method, function or procedure.
    E.g.: xUnit.net, NUnit, TestNG, Symfony Lime, etc.,


Prerequisites for Skill

The tester should know how to write a good unit test.

What Makes a Good Unit Test?

  • Readable - The intent of a unit test should be clear. If the test fails it would be easy to detect how to address the problem. With a good unit test, we can fix a bug without debugging the code!
  • Independent/Isolated – Unit tests are standalone, i.e., they should not rely on each other and have no dependencies on any external factors such as file system or database.
  • Repeatable – Unit test should be consistent with its results, i.e., it always returns the same result if you do not change anything in between runs.
  • Automatic/Self-Checking - The test should be able to automatically detect if it passed or failed without any human interaction.
  • Fast – Unit tests should take only little time to run.
The tester should have a knowledge of available unit testing tools.
There are several automated tools available to assist with unit testing.

Here is the list of some of the unit testing framework/tools:
1.NUnit
  • NUnit is a unit testing framework based on.NET platform.
  • It is an open source tool which allows writing scripts manually.
  • Supports data-driven tests that can run in parallel.
2.JUnit
  • JUnit is an open-source unit testing framework designed for Java Programming Language.
  • Supportive for the test-driven environment and the core idea on which it is based is ‘first testing than coding’.
  • Simplest and helps to write code easily and faster.
3.EMMA
  • Emma is an open-source toolkit that measures Java Code Coverage.
  • Emma support coverage types like method, line, basic block.
  • It is Java-based so it is without external library dependencies and can access the source code.


Related Software Engineering Area(s)

Functional Testing

Functional testing validates the software system against the functional requirements or specifications. The purpose of Functional tests is to test each function of the software application, by providing appropriate input, verifying the output against the Functional requirements.

API Testing

API testing involves testing application programming interfaces. The purpose of API Testing is to check the functionality, reliability, performance, and security of the programming interfaces.