The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
112 views

Best practice to return a long string in a stub

I have some methods im trying to test which use a StreamReader dependency that i mock using Rhino mocks. But it is a large xmlFile. In the spirit of unit testing im trying to keep away from using a ...
2
votes
4answers
280 views

Test Doubles, Mocks and Stubs - when not to use & why, for Ruby, Rspec

I've learned about mocking and stubbing and I've seen how they can help me create great test suites that run blindingly fast and thus speed up my development process hugely. However I've also seen ...
0
votes
2answers
97 views

Correct Seam for Stub

In Chapter 3 of his book The Art of Unit Testing: with Examples in C#, Roy Osherove illustrates the issue of undesirable external dependencies in code under test. He shows this with a method ...
3
votes
1answer
122 views

Stubbing and mocking boundaries

Suppose I'm building a JSON API and would like to include an endpoint that returns a list of recently created posts. Somewhere in my system is an existing Post model with the following test: create ...
1
vote
4answers
1k views

Moving from mock to real objects?

I'm like doing TDD so I started everything mocking objects, creating interface, stubbing, great. The design seems to work, now I'll implement the stuff, a lot of the code used in the stubs are going ...
13
votes
3answers
1k views

Is it okay to fake part of the class under test?

Suppose I have a class (forgive the contrived example and the bad design of it): class MyProfit { public decimal GetNewYorkRevenue(); public decimal GetNewYorkExpenses(); public decimal ...
3
votes
2answers
654 views

Has anyone used a Stub in production code?

I have a situation where some procedure returns an object (kind of like a DTO) with a certain interface: interface ISomeInterface { string StringReadOnlyProperty { get; } int ...