Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I am taking the help from these mentioned links and will modify accordingly as per my understanding:

Good links:

[Good explanation by Jim](httphttps://stackoverflow.com/questions/9677445/mock-framework-vs-ms-fakes-frameworks) [Explanation by martin frowler](http://martinfowler.com/articles/mocksArentStubs.html) [Informative Link, but a little advanced (talks about integration testing)](http://www.infoq.com/presentations/integration-tests-scam) Ok before going forward there are two things when You are Unit Testing:
  1. Sate Testing
  2. Behaviour Testing

In state testing You are only checking whether the actual method or System Under Test(SUT) is returning the correct value

In behaviour testing You check whether the correct method was called, or in other words whether a correct sequence of methods were called.

Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside the test method.Here You generally do State testing.

Mocks are used to verify interaction between your SUT and its dependencies.You generally do behavior testing here

I am taking the help from these mentioned links and will modify accordingly as per my understanding:

Good links:

[Good explanation by Jim](http://stackoverflow.com/questions/9677445/mock-framework-vs-ms-fakes-frameworks) [Explanation by martin frowler](http://martinfowler.com/articles/mocksArentStubs.html) [Informative Link, but a little advanced (talks about integration testing)](http://www.infoq.com/presentations/integration-tests-scam) Ok before going forward there are two things when You are Unit Testing:
  1. Sate Testing
  2. Behaviour Testing

In state testing You are only checking whether the actual method or System Under Test(SUT) is returning the correct value

In behaviour testing You check whether the correct method was called, or in other words whether a correct sequence of methods were called.

Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside the test method.Here You generally do State testing.

Mocks are used to verify interaction between your SUT and its dependencies.You generally do behavior testing here

I am taking the help from these mentioned links and will modify accordingly as per my understanding:

Good links:

[Good explanation by Jim](https://stackoverflow.com/questions/9677445/mock-framework-vs-ms-fakes-frameworks) [Explanation by martin frowler](http://martinfowler.com/articles/mocksArentStubs.html) [Informative Link, but a little advanced (talks about integration testing)](http://www.infoq.com/presentations/integration-tests-scam) Ok before going forward there are two things when You are Unit Testing:
  1. Sate Testing
  2. Behaviour Testing

In state testing You are only checking whether the actual method or System Under Test(SUT) is returning the correct value

In behaviour testing You check whether the correct method was called, or in other words whether a correct sequence of methods were called.

Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside the test method.Here You generally do State testing.

Mocks are used to verify interaction between your SUT and its dependencies.You generally do behavior testing here

Notice removed Needs detailed answers by maple_shaft
added more links and little bit of formatting
Source Link
Devesh
  • 445
  • 1
  • 5
  • 16

I am taking the excerptshelp from these mentioned links and will modify accordingly as per my understanding:

Good links Link1 Link2

Ok before going forward there are two things when You are Unit Testing:

[Good explanation by Jim](http://stackoverflow.com/questions/9677445/mock-framework-vs-ms-fakes-frameworks) [Explanation by martin frowler](http://martinfowler.com/articles/mocksArentStubs.html) [Informative Link, but a little advanced (talks about integration testing)](http://www.infoq.com/presentations/integration-tests-scam) Ok before going forward there are two things when You are Unit Testing:
  1. Sate Testing
  2. Behaviour Testing

In state testing You are only checking whether the actual method or System Under Test(SUT) is returning the correct value

In behaviour testing You check whether the correct method was called, or in other words whether a correct sequence of methods were called.

Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside the test method.Here You generally do State testing.

Mocks are used to verify interaction between your SUT and its dependencies.You generally do behavior testing here

I am taking the excerpts from these mentioned links and will modify accordingly as per my understanding:

Good links Link1 Link2

Ok before going forward there are two things when You are Unit Testing:

  1. Sate Testing
  2. Behaviour Testing

In state testing You are only checking whether the actual method or System Under Test(SUT) is returning the correct value

In behaviour testing You check whether the correct method was called, or in other words whether a correct sequence of methods were called.

Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside the test method.Here You generally do State testing.

Mocks are used to verify interaction between your SUT and its dependencies.

I am taking the help from these mentioned links and will modify accordingly as per my understanding:

Good links:

[Good explanation by Jim](http://stackoverflow.com/questions/9677445/mock-framework-vs-ms-fakes-frameworks) [Explanation by martin frowler](http://martinfowler.com/articles/mocksArentStubs.html) [Informative Link, but a little advanced (talks about integration testing)](http://www.infoq.com/presentations/integration-tests-scam) Ok before going forward there are two things when You are Unit Testing:
  1. Sate Testing
  2. Behaviour Testing

In state testing You are only checking whether the actual method or System Under Test(SUT) is returning the correct value

In behaviour testing You check whether the correct method was called, or in other words whether a correct sequence of methods were called.

Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside the test method.Here You generally do State testing.

Mocks are used to verify interaction between your SUT and its dependencies.You generally do behavior testing here

edited as per comments
Source Link
Devesh
  • 445
  • 1
  • 5
  • 16

Here is a good answerI am taking the excerpts from these mentioned links and will modify accordingly as per my understanding:

Good links http://stackoverflow.com/questions/9677445/mock-framework-vs-ms-fakes-frameworksLink1

A very good link http://martinfowler.com/articles/mocksArentStubs.htmlLink2

Ok before going forward there are two things when You are Unit Testing:

  1. Sate Testing
  2. Behaviour Testing

In state testing You are only checking whether the actual method or System Under Test(SUT) is returning the correct value

In behaviour testing You check whether the correct method was called, or in other words whether a correct sequence of methods were called.

Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside the test method.Here You generally do State testing.

Mocks are used to verify interaction between your SUT and its dependencies.

I am taking the excerpts from these mentioned links and will modify accordingly as per my understanding:

Good links Link1 Link2

Ok before going forward there are two things when You are Unit Testing:

  1. Sate Testing
  2. Behaviour Testing

In state testing You are only checking whether the actual method or System Under Test(SUT) is returning the correct value

In behaviour testing You check whether the correct method was called, or in other words whether a correct sequence of methods were called.

Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside the test method.Here You generally do State testing.

Mocks are used to verify interaction between your SUT and its dependencies.

Notice added Needs detailed answers by maple_shaft
Source Link
Devesh
  • 445
  • 1
  • 5
  • 16
Loading