Skip to content

Instantly share code, notes, and snippets.

View ellimist's full-sized avatar

Adrian Bordinc ellimist

View GitHub Profile

#Testing

  • Isolate the object under test, don’t test multiple objects under one test case, this creates unneeded code and technical debt.
  • Unit test behavior, not methods. We need to know how to use the class to achieve a goal, not how to exercise all the paths through its code.
  • Don't test active record, it isn't a special behavior that the system is performing.
  • You don't need 100% test coverage all the time.
  • Don’t test query messages ( messages that do not modify another object ).
  • Do test command messages ( messages that do modify another object ).
  • Test the public interface of an object, private methods are always changing and add technical debt to the test and code.
  • Mock objects that are outside of the current object test scope (roles, interfaces, other objects)