Motley says: “Slow down to go fast? Do I look like a tortoise?”

Summary   Motley:  There is no harm shortcutting a few steps of development to meet a deadline. Some up-front check-in steps just take too much time.   Maven: Slow down to go fast. Obey check-in checklists or you will pay for it later in the development cycle. Pre-check-in tasks such as code reviews, unit testing,…


Motley says: "More test automation is always better"

Summary   Motley:  A tester’s job is to find bugs, so measure them on the amount of bugs they find. More test automation is always better.   Maven: Do not measure testers by the amount of bugs they report. Think of the test team as more a quality assurance team than a quality control team….


Motley says: "Just use a batch file to run unit tests"

Summary   Motley:  Just use a batch file to execute unit tests – it’s easy and quick.   Maven: Use a unit test framework to write and execute unit tests. A framework makes tests easy to write, executes tests quickly and consistently, and provides features that make your life easier, such as logging. ______________________________  …


Motley says: "If-then-else hooks are the best way to inject mock objects"

Summary   Motley:  A simple if-then-else hook is the simplest and best way to inject a mock object.   Maven: First, you have to design to interfaces. Then, techniques like dependency injection, factories, and endo-testing are more effective ways to inject mock objects. ______________________________   [Context:  Maven and Motley continue a discussion on mock objects….


Motley says: "Test both private and public methods"

Summary   Motley: To get high code coverage, we should be testing both public and private methods   Maven: Only test public methods. Testing private methods gets in the way of refactoring ______________________________   [Context:  Maven checks in on Motley’s unit testing practices and notices something odd]   Maven: Hey Mot – how is the…


Motley says: "Contracts are for baseball players and cell phones"

Summary   Motley: Contracts don’t apply to software – leave them for baseball players and cell phone providers   Maven: Contracts (preconditions, postconditions, invariants) help drive your unit tests ______________________________   [Context:  Motley is all excited as he has started to measure code coverage on his tests]   Maven: Hey Mot. Remember that conversation a…


Motley says: "100% code coverage tells me there is nothing left to test"

Summary   Motley: If I hit 100% code coverage for my tests, then there is nothing left to test.   Maven: 100% line coverage does not necessarily mean you have full test coverage. You have to consider condition coverage as well. ______________________________   [Context:  Motley is all excited as he has started to measure code…


Motley says: "Refactoring is too hard – it’s not worth the effort"

Summary   Motley: Every time I make a change in refactoring I either cause compile problems or break functionality. Refactoring is slow and not worth the effort.   Maven: Use tools to refactor and leverage unit tests to improve your confidence that your refactoring does not break functionality. ______________________________   [Context: Motley is refactoring some…


Motley says: "I don’t have time to Refactor – I need to get it right the first time"

  Summary   Motley: Refactoring takes too much time – I have to ship you know!   Maven: Refactoring leads to much more maintainable code, and if you have tests in place, the return on investment far outweighs the cost. ______________________________   [Context: Motley has just embarked on his first adventures with TDD, but Maven…


Motley says: "If I write code to pass tests I’m cheating!"

  Summary   Motley: Tests need to validate code that has already been written – not the other way around.   Maven: Writing tests before you code allows the tests to drive your code while providing more sound requirements validation. ______________________________   [Context: Motley is thinking through test-driven development before he goes off and tries…