Timeline for Is mocking for unit testing appropriate in this scenario?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 1, 2012 at 13:56 | history | edited | sourcenouveau | CC BY-SA 3.0 |
Added dependency injection and unit test example code
|
Oct 1, 2012 at 13:51 | history | edited | sourcenouveau | CC BY-SA 3.0 |
Added dependency injection and unit test example code
|
Oct 1, 2012 at 13:05 | comment | added | sourcenouveau | When unit testing a single method, you should create a unit test for each use case. That is, in each unit test you specify different input values to the method, and verify that the output is the correct value. If the method has a dependency on a web service, you mock out the web service so that it behaves as expected in that use case. For example you may write mock code for the web service to provide values that are considered inputs to the method. | |
Oct 1, 2012 at 12:46 | comment | added | Vinoth Kumar C M | If we are mocking both input and output, then what is the point ? How do we mock the output in the first place ? | |
Oct 1, 2012 at 12:43 | history | answered | sourcenouveau | CC BY-SA 3.0 |