What is Component testing?

Component testing is a methodology of testing each component in an application separately. Suppose a website or a software has 10 different components then all 10 components are tested separately and uniquely.

Component testing is also called as module testing or program testing. Generally component testing is done by testers. Component testing is done in complete isolation from other system environment.
Two or more people running the tests on different laptops or desktops are not going to block each other’s work. Running the test in isolation depends on the software development life cycle model.
In case the missing software is replaced by stubs and driver and simulate the interface between the software components in a simple manner.

Let’s learn this with the help of example:

Suppose in a software there are three components say Component A, Component B and Component C. The developer has developed Component B and wants to test it.
But in order to test the component B completely few of its functionalities are dependent on component A and component But component A and component C is not developed yet.
In that case to test component B completely we will replace component A and component C by Stubs and Drivers.

Stub: A stub is called from software component to be tested. As shown in diagram below Stub is called by ‘component A’.

Driver: A driver calls the component to be tested. As shown in the diagram below ‘component B’ is called by the ‘Driver’.

Diagram below shows component testing.

Levels of testing, software testing interview questions
Why Component Testing?

A. The Largest Gap in Testing Today

Today most common type of testing performed are

1. Unit Testing and
2. End to end Testing

Unit tests operate at functional level and assures written code executes as intended. But as you move away from isolated piece of code or functionality it becomes difficult to maintain unit test that verify the quality of code.

End to End test

End to end test operate at end user level and assures the developed application or software behaves as expected. But this type of testing is good for testing platforms, but it isn’t safe for these tests to take over platform and start editing database records etc. directly, there is limit for test scenarios.

Component testing is a bridge in between these two types of testing. It perform actions like end-users do, so it can focus on those parts of your apps much easier (and cheaper) than unit testing can.
In component testing user can safely edit database records or perform any other setup steps to reproduce all of your test scenarios. Component test cannot replace unit tests for code libraries or end-to-end tests for platforms.
Component tests need an interface (web, command-line, network API) to interact with.

B. Component Tests Catch Faults Earlier:

If the faults are detected earlier, cheaper it is to fix. If the bugs are detected earlier and fixed before release, then less time is spend on rework.
C. Component Testing is capable of performing Deep Inspection:

D. Component tests can log into machines in the test environment to check database records, log files. Checking this is a good practice as it ensure our developed component is working properly.
Component test can also truncate log files to check whether data is getting properly inserted into database and it also shows what’s happening on server side.

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *