|
| 1 | +Testing the Impossible |
| 2 | + |
| 3 | +Will be going through Copycopter client. What is that? |
| 4 | + * write place holders in code where things are uploaded to copycopter |
| 5 | + * anyone can edit from copycopter |
| 6 | + * copycopter changes pushed back to app |
| 7 | + |
| 8 | +Copyclient requirements (when they built it): |
| 9 | + * automatic |
| 10 | + * easy to setup |
| 11 | + * cannot affect production performance |
| 12 | + |
| 13 | +Copyclient features: |
| 14 | + * 100% test driven |
| 15 | + |
| 16 | +Don't mix concerns. Separation of Concerns: |
| 17 | + * single responsibility principle: every object should have a single responsibility that is defined by its class. |
| 18 | + * A responsibility is a reason for change. |
| 19 | + * the more things you have to test, the harder, slower, and more confusing it becomes |
| 20 | + |
| 21 | +Inherit Less: |
| 22 | + * cannot test sub-class without testing super-class |
| 23 | + |
| 24 | +Prefer composition to inheritance: |
| 25 | + * things are not usually hierarchal |
| 26 | + |
| 27 | +Don't Depend on Concretions: |
| 28 | + * Dependency Inversion Principle: high level modules should not depend on low level modules |
| 29 | + * dependency injection: wiki this to learn more |
| 30 | + |
| 31 | +Avoid Soup |
| 32 | + |
| 33 | +Create Seams: |
| 34 | + * composed methods that support dependency injection |
| 35 | + |
| 36 | +Testing Design: |
| 37 | + * test scope: |
| 38 | + * unit, component, isolation |
| 39 | + * functional, acceptance, integration, full stack |
| 40 | + * restrict fixture scope: |
| 41 | + * use fresh fixtures - create what you need for test in the test |
| 42 | + * avoid test helpers |
| 43 | + * test doubles: |
| 44 | + * stubs, mocks, proxies, and fakes |
| 45 | + * USE FAKES: |
| 46 | + * easier to be DRY, easier to be strict |
| 47 | + * easy to distribute / share with others |
| 48 | + |
| 49 | +Rails: |
| 50 | + * stay generic: |
| 51 | + * use middleware when possible |
| 52 | + * avoid monkey patches |
| 53 | + * keep business logic outside engine parts |
| 54 | + * use Railties only for configuration/initialization |
| 55 | + * integration test |
| 56 | + * generate a rails app |
| 57 | + * install your gem |
| 58 | + * exercise major paths |
| 59 | + * boot a server process if you need to |
| 60 | + * test across several versions |
| 61 | + * isolation tests: |
| 62 | + * unit test components without Rails |
| 63 | + * don't even load ActiveSupport |
| 64 | + * test Rails-specific components separately |
| 65 | + * use fakes |
| 66 | + |
| 67 | +Don't be afraid |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
0 commit comments