Subscribe by Email

Saturday, December 17, 2011

What are different characteristics of unit testing?

Unit testing as the name itself suggests is a testing technique to examine individual units or modules of the program to make sure that they have been programmed properly and do not contain any flaw or mistake and to determine that they are fit for integration.

A unit or module is the smallest part of a software system or program and cannot be divided further. So units need to be totally flawless so as to make up a good software system. They should be able to work in collaboration with each other. Concept of unit is different in different kinds of programming. Like in object oriented programming a module is taken to be an interface or a data type (for e.g. class, structure etc) whereas in procedure oriented programming, a unit is referred to an individual loop or a function.

Unit testing is carried out with aid of unit tests cases which are developed by professional programmers who are expert white box testers. Unit testing is done during the development of the program or we can say at a much unsophisticated level. This level is unit testing level.

Each and every test case is designed differently. Before testing a unit it should be isolated properly. Several methods are used for isolation. Few have been listed below:
- Mock objects
- Test harnesses
- Method stubs
- Fakes

Software developers only carry out the desired unit tests to determine whether the software system is behaving as desired or not. Unit tests can be implemented either manually or by the use of build automation. There are several benefits of unit testing.

- Unit testing aims at examining the individual parts or units or modules and to determine that they are working properly.
- A unit test serves as a contract or a condition that a unit must accomplish or satisfy to get listed as a proper unit.
- One of the basic advantages of unit testing is that it helps in detecting flaws early during the development phase. This is very much needed as it reduces the number of potential bugs and future hard work that would have been done to correct those resulting errors.
- Unit testing allows the tester to modify the code so that it is still able to integrate with the other units of the program. But, later it is required to develop new test cases so that the changes in the unit can be tested for errors.
- Unit testing makes it easier for the software developer to carry out other types and levels of testing.

Nowadays, the test cases are readily available. Using such test cases save the time of the software developer but they are not so effective in testing. Above all the matters, the ebst thing about unit testing is that it maintains the accuracy of the software system.

The hard ships of integration testing are reduced effectively by a large amount. - Every unit has a detailed documentation. So it becomes much easier to understand the function of the unit.
- Documentations are needed to develop effective test cases.
- Test cases bring out the weak points as well as strong points of the units.
- Each test case is uniquely designed to test a different aspect of the unit like class and its behavior.
- Sometimes while unit testing objects within an object are encountered where it becomes important to check those objects. This causes the unit test to fail. So it becomes important to isolate the unit before testing it using the techniques mentioned above.

Any kind of testing cannot be expected to find each and every error. In addition to this the unit testing is limited to test only the functionalities of a unit and nothing more than that.

No comments:

Facebook activity