Leanpub Header

Skip to main content

Test-Driven Development: Rozbudowany samouczek (nieoficjalne tłumaczenie)

Nieoficjalne polskie tłumaczenie książki Test-Driven Development - Extensive Tutorial.

Ta książka jest próbą stworzenia obszernego samouczka, po polsku, dotyczącego Test-Driven Development (TDD).

Free With Membership

This book is a translation into Polish of Test-Driven Development: Extensive Tutorial which was originally written in English

With Membership

Free!

$7.99

You pay

$7.99

Authors earn

$6.39
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
WEB
73
Readers
About

About

About the Book

Polska wersja rewelacyjnej książki o TDD (oryginał tutaj). Książka jest streszczeniem wielu publikacji uznanych autorytetów IT takich jak Kent Beck, Martin Fowler czy Robert C. Martin. Jednocześnie przystępny język i przykłady z życia codziennego czynią książkę bardzo atrakcyjną - zarówno dla osób rozpoczynających swoją przygodę z programowaniem, jak i starych wyjadaczy.

Share this book

This book is a translation into Polish of Test-Driven Development: Extensive Tutorial which was originally written in English

Author

About the Authors

Grzegorz Gałęzowski

Coder, object oriented designer, trainer and blogger (feelings-erased.blogspot.com), currently working for Motorola Solutions in Poland, where he takes part in designing and coding object-oriented systems for telecom sector and training new staff in skills such as design patterns and test-driven development. in his free time, he enjoys playing acoustic guitar and spamming soundcloud with his amateur compositions.

Borysław Bobulski

No-one Neo

Contents

Table of Contents

Przedmowa

Dedykacja

Podziękowania!

O przykładach kodu

  1. Uwagi dla programistów języka C#
  2. Uwagi dla programistów języka Java
  3. Część 1: Same podstawy

Motywacja – pierwszy krok w uczeniu się TDD

  1. Jakie jest TDD?
  2. Zaczynajmy !

Niezbędne narzędzia

  1. Test framework
  2. Framework do mockowania
  3. Generator wartości anonimizowanych
  4. Podsumowanie

To nie (tylko) test

  1. Kiedy test staje się czymś więcej
  2. Testy w świecie programistów
  3. Raczej specyfikacja niż zbiór testów
  4. Różnice między “wykonywalnymi” specyfikacjami i tymi “tradycyjnymi”

Programowanie poprzedzone wymaganiem (Wymaganie-najpierw)

  1. Po co pisać specyfikację po fakcie?
  2. “Najpierw-test” oznacza patrzenie na niepowodzenie
  3. “Test-Po” często kończy jako “Test-Nigdy”
  4. “Test-Po” często prowadzi do ponownego projektowania
  5. Podsumowanie

Poćwiczmy to, czego się właśnie nauczyliśmy

  1. Pozwól mi opowiedzieć sobie historię
  2. Akt 1: Samochód
  3. Akt 2: Tytuł dla Klienta
  4. Akt 3: Test-Driven Development
  5. Epilog

Odnajdźmy się odrobinę

How to start?

  1. Start with a good name
  2. Start by filling the GIVEN-WHEN-THEN structure with the obvious
  3. Start from the end
  4. Start by invoking a method if you have one
  5. Summary

How is TDD about analysis and what does “GIVEN-WHEN-THEN” mean?

  1. Is there really a commonality between analysis and TDD?
  2. Gherkin
  3. TODO list… again!

What is the scope of a unit-level Statement in TDD?

  1. Scope and level
  2. On what level do we specify our software?
  3. What should be the functional scope of a single Statement?
  4. Failing to adhere to the three rules
  5. How many assertions do I need?
  6. Summary

Developing a TDD style and Constrained Non-Determinism

  1. A style?
  2. Principle: Tests As Specification
  3. First technique: Anonymous Input
  4. Second technique: Derived Values
  5. Third technique: Distinct Generated Values
  6. Fourth technique: Constant Specification
  7. Summary of the example
  8. Constrained non-determinism
  9. Summary

Specifying functional boundaries and conditions

  1. Sometimes, an anonymous value is not enough
  2. Exceptions to the rule
  3. Rules valid within boundaries
  4. Combination of boundaries – ranges
  5. Summary

Driving the implementation from Specification

  1. Type the obvious implementation
  2. Fake it (‘til you make it)
  3. Triangulate
  4. Summary
  5. Part 2: Object-Oriented World
  6. Status: pretty stable
  7. Teaching one thing at a time

On Object Composability

  1. Another task for Johnny and Benjamin
  2. A Quick Retrospective

Telling, not asking

  1. Contractors
  2. A Quick Retrospective

The need for mock objects

  1. Composability… again!

Why do we need composability?

  1. Pre-object-oriented approaches
  2. Object-oriented programming to the rescue!
  3. The power of composition
  4. Summary – are you still with me?

Web, messages and protocols

  1. So, again, what does it mean to compose objects?
  2. Alarms, again!
  3. Summary

Composing a web of objects

  1. Three important questions
  2. A preview of all three answers

When are objects composed?

How does a sender obtain a reference to a recipient (i.e. how connections are made)?

  1. Receive as constructor parameter
  2. Receive inside a message (i.e. as a method parameter)
  3. Receive in response to a message (i.e. as method return value)
  4. Receive as a registered observer

Where are objects composed?

  1. Composition Root
  2. Factories
  3. Summary

Interfaces

  1. Classes vs interfaces
  2. Events/callbacks vs interfaces – few words on roles
  3. Small interfaces

Protocols

  1. Protocols exist
  2. Protocol stability
  3. Craft messages to reflect sender’s intention
  4. Model interactions after the problem domain
  5. Message recipients should be told what to do, instead of being asked for information
  6. Most of the getters should be removed, return values should be avoided
  7. Protocols should be small and abstract
  8. Summary

Classes

  1. Single Responsibility Principle
  2. Static recipients
  3. Summary

Object Composition as a Language

  1. More readable composition root
  2. Refactoring for readability
  3. Composition as a language
  4. The significance of a higher-level language
  5. Some advice
  6. Summary

Value Objects

  1. What is a value?
  2. Example: money and names

Value object anatomy

  1. Class signature
  2. Hidden data
  3. Hidden constructor
  4. String conversion methods
  5. Equality members
  6. The return of investment
  7. Summary

Aspects of value objects design

  1. Immutability
  2. Handling of variability
  3. Special values
  4. Value types and Tell Don’t Ask
  5. Summary
  6. Part 3: TDD in Object-Oriented World
  7. Status: under development

Mock Objects as a testing tool

  1. A backing example
  2. Interfaces
  3. Protocols
  4. Roles
  5. Behaviors
  6. Filling in the roles
  7. Using a mock channel
  8. Mocks as yet another context
  9. Summary

Test-first using mock objects

  1. How to start? – with mock objects
  2. Responsibility and Responsibility
  3. Channel and DataDispatch one more time
  4. The first behavior
  5. Second behavior – specifying an error
  6. Summary

Test-driving at the input boundary

  1. Fixing the ticket office
  2. Initial objects
  3. Bootstrap
  4. Writing the first Statement
  5. Summary

THIS IS ALL I HAVE FOR NOW. WHAT FOLLOWS IS RAW, UNORDERED MATERIAL THAT’S NOT YET READY TO BE CONSUMED AS PART OF THIS TUTORIAL

Test-driving at the input boundary - a retrospective

Mock objects as a design tool

  1. Outside-in development
  2. Worked example
  3. Programming by intention
  4. Responsibility-Driven Design
  5. Specifying factories

What not to mock?

  1. Internals
  2. How to use value objects in Statements?
  3. How to specify value objects?
  4. Terminal nodes in object graph

Guidance of test smells

  1. Long Statements
  2. Lots of stubbing
  3. Specifying private members
  4. Mocking third party

Revisiting topics from chapter 1

  1. Constrained non-determinism in OO world
  2. Behavioral boundaries
  3. Triangulation

Maintainable mock-based Statements

  1. Setup and teardown

Refactoring mock code

  1. Part 4: Application architecture

On stable/architectural boundaries

Ports and adapters

  1. Physical separation of layers

What goes into application?

  1. Application and other layers

What goes into ports?

  1. Data transfer objects
  2. Ports are not a layer
  3. Part 5: TDD on application architecture level

Designing automation layer

  1. Adapting screenplay pattern
  2. Driver
  3. Actors
  4. Data builders

Further Reading

  1. Motivation – the first step to learning TDD
  2. The Essential Tools
  3. Value Objects

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub