måndag 19 mars 2012

Software Passion: Unit Testing Styles and Mockito

Per Lundholm 


Starts with a unit-testing styles and then describing some interesting parts of mockito.

You need to know what you test:

  • Verify State:
  • Verify Behaviour:

Different mocking components:

  • Dummy Objects
  • Not actually of any production use, but can fill up parameters.
  • Fake Objects:
  • Stubs:
  • Canned answers:
  • Mocks:

Book recommendation:
XUnit Test Patterns - Gerard M

Legacy code: Capture what the legacy system produces as a result and use that as expected in a unit test.

  • To verify that I do not break anything
  • To learn about the legacy code.
  • To see changes.

Book Recommendation:
Working effectively with Legacy Code: Michael Ferris

The talks ends with interesting discussions and questions:

Better to write code that can be tested than code that is private.

To change code you have to have tests.

Inga kommentarer:

Skicka en kommentar