Stub in Unit Testing

Stub is nothing but a miniature replica of the Actual working code of a application, Stubs are used to test the application data. Stub return a value which is imitations or similar data of the application.

For example if actual application returns a list of Strings, then Stubs also returns list of Strings but only difference is Stub returns a dummy value, so in this case we cannot perform data validation.

Sometimes stub is a miniature of the Actual program, for instance, if actual application returns 10, 000 Strings, stub may return 100 String or 10 String. When user creates the miniature stubs, the stub may return 1 - 10% data of tha actual application

About Author

Myself KarthiQ, I am the author of this blog, I know ways to write a good article but some how I donot have the skills to make it to reach people, would you like help me to reach more people By sharing this Article in the social media.

Share this Article Facebook
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions

Recent Addition

new tutorial Selenium Online Training : Our next online training course for Selenium with Java starts from 17th December 2018.

You can attend first 3 classes for free, the total course fee is INR 10,000

The course time would be 8.00 PM(IST) for the first three classes

If you are interested to learn, then you can join the course by sending email to

or Register below

Join My Facebook Group
Join Group