Test-driven Python development : develop high-quality and maintainable Python applications using the principles of test-driven development

Uloženo v:
Podrobná bibliografie
Hlavní autor: Govindaraj, Siddharta  
Médium: Kniha
Jazyk:angličtina
Vydáno: Birmingham ; Mumbai : Packt Publishing, 2015
Edice:Community experience distilled
Žánr/forma:příručky
ISBN:978-1-78398-792-4
Témata:
Tagy: Přidat tag
Žádné tagy, Buďte první, kdo otaguje tento záznam!
Obálka
Obsah:
  • Table of Contents Preface____________________________________________________________________vii Chapter 1 Getting Started with Test-Driven Development_1
  • Prerequisites
  • Understanding test-driven development
  • TDD versus unit testing versus integration testing
  • Using TDD to build a stock alert application
  • Writing our first test
  • Analyzing the test output
  • Test errors versus test failures
  • Making the test pass
  • Reorganizing the test code
  • Running the tests after the reorganization
  • Summary
  • Chapter 2 Red-Green-Refactor - The TDD Cycle__17
  • Tests are executable requirements
  • Arrange-Act-Assert
  • Documenting our tests
  • Testing for exceptions
  • Exploring assert methods
  • Specific asserts versus generic asserts
  • Setup and teardown
  • Brittle tests
  • Refactoring the design
  • Refactoring tests
  • Exploring the Rule classes
  • Exercise
  • Summary
  • Table of Contents Chapter 3 Code Smells and Refactoring_______41
  • A dual crossover moving average
  • Implementing the dual crossover moving average
  • Identifying code smells
  • Refactoring
  • The Rename Variable and Rename Method refactorings
  • Commenting Styles
  • Replace Magic Literals with Constants
  • The Extract Method refactoring
  • Replace Calculation with Temporary Variable
  • Extract Conditional to Method
  • The DRY principle
  • Single Responsibility Principle
  • Extract Class
  • Move Method to Class
  • The importance of tests
  • Exercise
  • Wrapping up
  • Summary
  • Chapter 4 Using Mock Objects to Test Interactions_71
  • Hand writing a simple mock
  • Using the Python mocking framework
  • Mocking objects
  • Mocking return values
  • Mocking side effects
  • How much mocking is too much
  • Mocks versus stubs versus fakes versus spies
  • Patching methods
  • An important gotcha when patching
  • Tying it all together
  • Summary
  • Chapter 5 Working with Legacy Code_99
  • What is legacy code
  • Understanding the code
  • What are characterization tests
  • Using the Python interactive