Andrew Burrows - Testing the untestable: a beginner’s guide to mock objects

preview_player
Показать описание
Andrew Burrows - Testing the untestable: a beginner’s guide to mock objects
[EuroPython 2016]
[22 July 2016]
[Bilbao, Euskadi, Spain]

In this session you will learn your way around Python 3’s
class, sentinels and patching. You will see the benefits that mocks
can bring and learn to avoid the pitfalls. Along the way I’ll fill you
in on some of the bewildering terminology surrounding mocks such as
“SUT”, “Stub”, “Double”, “Dummy” , “mockist” and more and I’ll give a
brief plug for my own mockextras package that can enhance your mock
experience.

-----

Mock objects can be a powerful tool to write easy, reliable tests for
the most difficult to test code. In this session you will learn your
examples and working through progressively more problematic code.
You’ll learn about the Mock class, sentinels and patching and how and
when to use each of them. You will see the benefits that mocks can
bring and learn to avoid the pitfalls. Along the way I’ll fill you in
on some of the bewildering terminology surrounding mocks such as
“SUT”, “Stub”, “Double”, “Dummy” , “mockist” and more and I’ll give a
brief plug for my own mockextras package that can enhance your mock
experience.
Рекомендации по теме
Комментарии
Автор

Finally a good introduction to mocking!

pitersi
Автор

I gave a follow up talk at PyGotham 2017 which basically picks up where this one leaves off:

andrewstewartburrows
Автор

the whole `sut` thing is literal aids - sure, it's the sut but at the same time it's still an instance of a class. SUT is not a particularly specific name cognitively and could refer to anything.

Calg