The document outlines 7 steps for unit testing: 1) determine what to test, 2) prepare test projects, 3) pick simple scenarios to test, 4) identify dependencies, 5) simplify code design for testing, 6) write tests using arrange-act-assert, and 7) continue testing additional scenarios. The goal is to introduce unit testing and provide guidance on setting up tests, writing test cases, and refactoring code for testability.
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Unit testing the prequel
1. Unit Testing – The Prequel
Gil Zilberfeld, Product Manager
Jan 29th, 2013
@gil_zilberfeld
2. Prepare
• Know your tools
• Evaluate the risk
• Choose your partner
@gil_zilberfeld
3. Step 1: What to test
• What to test:
• What you’re
working on
• Bug or feature?
• Logic
• What not to test:
• Multithreading
• Stored procedures
• UI
@gil_zilberfeld
4. Step 2: Get ready
• Pick organization strategy
• Create test projects
• Remove fluff
• VS I’m looking at you
@gil_zilberfeld
5. Step 3: Pick a scenario
• Scenario:
• Context
• Action
• Success criteria
• Pick the simplest
one
• Say it!
• Name it!
• Assert it!
@gil_zilberfeld
12. Step 5: Simplify design
• Automatic refactoring
• Close down regions you’re not going to cover
• Rename fields
• Extract methods
• Manual refactoring works too
• …but more risky
@gil_zilberfeld
13. Step 6: Here we go!
• Arrange
Run
Fail
• Arrange
Run
Fail
…..
• Success!
@gil_zilberfeld
14. Step 7: Next!
• Pick the next
scenario
• Say it
• Name it
• Assert it
• Mutate the test
setup
• Arrange
Run
Fail
…
• Win!
@gil_zilberfeld
15. Congratulations!
• This is just the beginning
• Lifetime improvement
• Picking scenarios
• Naming
• Mocking
• Refactoring
• … and much more!
@gil_zilberfeld