Stub or Mock in JUnit

Ads

 
 

Share on Google+Share on Google+

neelam
Stub or Mock in JUnit
1 Answer(s)      6 years and 11 months ago
Posted in : JUNIT

What is stub and Mock in JUnit? Please give one real time example so that i can understand easily.

Ads
View Answers

December 6, 2010 at 5:33 PM


Consider a situation, where you have a class Calculator, that needs a dao (Data Access Object) object to load the data it needs from a database. Setting up the connection and inserting the data in the database can be a lot of work.

Instead you can provide the Calculator instance with a fake dao class which just returns the data you need for the test. The fake dao class will not actually read the data from the database. The fake dao class is a mock object or stub object.


Ads









Related Tutorials/Questions & Answers:
Stub or Mock in JUnit
Stub or Mock in JUnit  What is stub and Mock in JUnit? Please give one real time example so that i can understand easily.   Consider... the database. The fake dao class is a mock object or stub object
spring with junit and mock testing
spring with junit and mock testing  spring with junit mock testing
Advertisements
Functionality of the stub
Functionality of the stub  hii,, What is the functionality of the stub?   hii Stub: Stub is a client side representative. The functionality of stub is Marshalling and Unmarshalling in RMI(Remote method invocation
Junit
Junit  How to capture junit error reports in to a file
junit
junit  why we are going to junit?   Hi, Junit is unit... developers to write Unit test to test their code. Junit test is used to test the applications. Read JUnit Tutorial. Thanks
junit - JUNIT
JUnit  What is Junit
junit
junit  i want to learn junit for user guidence for easy format to understnad to study. please provide that one
junit
junit  Explain about junit?   Junit is new framework designed for Java to perform unit testing. It is an Open source framework. Junit... ). It helps the developers in designing and writing test cases. Junit also have
Junit
Junit  Hi sir My question to you is - What is JUnit?   Hi Friend, Junit is a Unit testing framework for java programming language. It is part of the Unit testing framework family collectively know
Junit
Junit  hii.... how to create junit of methods having parameters passed in it..... for example : plz dont refer any link. Just help me by junit of this code. public boolean validateUser(final Display display) { int
Junit
) { UniversalData.connectionDetails = connectionDetails; }** if i want to make a test case using Junit...; regards Ankit Chauhan   Have a look at the following link: Junit Testing
junit - JUNIT
junit  can u give me a sample application of using junit?  Hi Friend, Please visit the following link: http://www.roseindia.net/junit/ Hope that it will be helpful for you. Thanks
Using Spring mock objects
Using Mock objects Mock Object is object that mimic/copy some real object... object. It originally became popular by the junit team and the expert programmers/developers. The mock object simulate the behavior of real, complex
JUnit - JUNIT
JUnit test cases in java  How to write a test case for JUnit in Java...;public class SimpleTest extends TestCase{ JunitExample junit = new JunitExample... information,http://www.roseindia.net/junit
JUNIT - JUNIT
JUNIT  Hi, all please help me ..... how to Generate Cactus Report for JUNIT Testcase... These Test cases are written for JSFPages..it's very Urgent in our Project. Thanks in Advance
The skeleton and stub in Java - Java Beginners
The skeleton and stub in Java  Hi, I want to know more about skeleton and stub in Java programming language. What is skeleton and stub? What is the purpose of skeleton and stub? Thanks   Hi Friend, Stub
Version of directory-asn1>stub-compiler dependency
List of Version of directory-asn1>stub-compiler dependency
Version of cn.leancloud>android-stub dependency
List of Version of cn.leancloud>android-stub dependency
Version of junit>junit dependency
List of Version of junit>junit dependency
junit testing - JUNIT
junit testing  How to perform a testing in JUnit?  Hi,Could you please explain me in detail "junit testing on stack". What is stack and how do you want to test?Please let's know, I will try to provide
install junit - JUNIT
install junit  How to install Junit?  Download it from here http://www.roseindia.net/junit/downloadingandinstallingjunit4.3.1.shtml
Version of junit>junit-dep dependency
List of Version of junit>junit-dep dependency
Version of spring>spring-mock dependency
List of Version of spring>spring-mock dependency
Version of springframework>spring-mock dependency
List of Version of springframework>spring-mock dependency
Version of com.amitinside>com.amitinside.sling.testing.osgi-mock dependency
List of Version of com.amitinside>com.amitinside.sling.testing.osgi-mock dependency
Version of com.fiftyonred>mock-jedis dependency
List of Version of com.fiftyonred>mock-jedis dependency
Version of com.headius>coro-mock dependency
List of Version of com.headius>coro-mock dependency
Version of com.headius>unsafe-mock dependency
List of Version of com.headius>unsafe-mock dependency
Version of com.statemachinesystems>mock-clock dependency
List of Version of com.statemachinesystems>mock-clock dependency
Version of com.tacitknowledge>jcr-mock dependency
List of Version of com.tacitknowledge>jcr-mock dependency
Junit
JUnit Junit is new framework designed for Java to perform unit testing. It is an Open source framework. Junit is an instance of xUnit architecture... and writing test cases. Junit also have a Graphical User Interface which allows

Ads

 
Advertisement null

Ads