Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In terms of handling large chages... the purpose of TDD is to test the behaviors of your code and how it interacts with the services that it depends on. If you we wanting to use TDD and you were moving from a DOM parser to a SAX parser and you were writing the sax parser yourself then you would write tests that verified the behavior of the SAX parser based on a known input ie an XML document. The SAX parser may depend on a collection of helper objects that could in fact be mocked out initially for the purposes of testing the behavior of the SAX parser. When you were ready to write the implementation code for the helper objects you could then write tests around their expected behavior based on a known input. In the example of the SAX parser you would write seperate classes to implement this behavior so as to not interfere with the existing code you have that depends on the DOM Parser. In fact what you could to is create an IXMLParser interface that DOM parser and the SAX parser implement so that you could switch them out at will.</p> <p>As far as using mocks or stub are concerned the reason you use a Mock or a Stub is that you are not interested in testing the inner workings of the Mock or the Stub, but you are interested in testing the inner workings of what depend on the mock or the stub and that is what you are truely testing from a unit perspective. If you are interested in writing integration tests then you should write integration tests and not unit tests. I find writing code in a TDD fashion is useful for helping me define the structure and organization of my code around the behavior I am being asked to provide.</p> <p>I am not familiar with any case studies off-hand, but I am sure they are out there. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload