For large or smalle Code of Applications it is Programmers job to test their code.Unit Testing one of the levels in Software Testing is purely for the developers.They have to write unit tests and they have to examine(test) their code.
A good unit test case is a small piece of code(mostly written in a single method)which is for testing specific functionality.In Large,complex well designed systems different objects have to work together to accomplish a particular task.
For example in order to write a simple test case to verify Login functionality user name and password has to be taken from database and using these as inputs test case has to be executed.
So if we are using database we have to create many objects(eg:Objects for Prepared statements,Result Set,DB Connection etc..).It is a complicated task to create some 'N' objects for testing simple unit test case.Creating these 'N' doesn't make our unit test to be completed in quick time.
Mock Objects are the Objects which Pretended to be as Real Objects makes this process easier.A mock object is a replacement for a real object that we create for the express purpose of testing. Mock objects were championed by Tim Mackinnon, Steve Freeman, and Philip Craig
There are Many Frameworks for effective usage of mock objectes in our unit tests like JMock,Mockito,EasyMock etc..
No comments:
Post a Comment