Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Unit and Functional Testing with Symfony2

Unit and Functional Testing with Symfony2

Practices, tools, Q&A

Sergey Zhuravel

February 08, 2017
Tweet

More Decks by Sergey Zhuravel

Other Decks in Programming

Transcript

  1. This Document is Confidential Must • Test only one thing

    at a time. • Test method's name matters a lot. It must be clear "what it tests" from the method's name. • The conditional logic (if, foreach, while, else and so on) must not be used in tests. • Each test method must be run in a isolation from other tests. • Do not use @depends in unit tests. • Do not use setUp method for business logic or mock expectations initialization. • Skipped test has to be fixed or deleted. The exception is environment based tests. • Do not mock DTO/VO/POPO. • Do not use data providers to configure mocks • Do not extend test classes. It is ok to extend abstract class. Do not put test methods to abstract class, only helper methods.
  2. This Document is Confidential • Do not use @depends in

    functional tests. • DRY principle may be broken in tests. The goal to make tests easy to read and understand. • If the unit tests looks like hard to write. It require a lot of mocks. it may be a problem with SUT. Consider this. • Unit tests with a lot of mocks (about 5-7 but it depends) should be reviewed. Should