Workshop slides for "Outside-in Test Driven Development - die Londoner Schule des TDD" @ Software Quality Days 2019.
In Outside-In (London school, top-down or "mockist TDD") you build the system from the "outside-in", following the user interaction through all the parts of the system. You start with the interactions and collaborators upfront (especially those at top levels), mocking necessary dependencies (or creating fake implementations). With every finished component, you move to the previously mocked collaborators and start with TDD again there, creating actual implementations (which, even though used, were not needed before thanks to abstractions).
Event-driven architecture, the easy way.pdfMichał Kurzeja
Od wielu lat rozmawiamy o tworzeniu systemów, które są lepiej podzielone. Łatwiejsze w rozbudowie i utrzymaniu, pięknie napisane i dobrze podzielone na moduły. Wiele czasu poświęciliśmy na dyskusje o mikroserwisach, CQRS, event sourcingu, itp. Ale czy można prościej? Postaram się przybliżyć proste podejście do event-driven architecture, wspomnę też o wadach.
The tests are trying to tell you something@VoxxedBucharest.pptxVictor Rentea
If tests are hard to write, the production design is crappy - goes an old saying. Indeed, writing unit tests gives you one of the most comprehensive, yet brutal, feedback about the design of your production code, but if it comes too late, many developers can’t stand it anymore and they will either stop testing or test more superficially. At the other extreme, others struggle to write contrived, fragile tests full of mocks that end up frustrating more than helping them. This talk reviews the main hints that unit tests provide you, from the most obvious improvements to some of the most subtle design principles.
Event-driven architecture, the easy way.pdfMichał Kurzeja
Od wielu lat rozmawiamy o tworzeniu systemów, które są lepiej podzielone. Łatwiejsze w rozbudowie i utrzymaniu, pięknie napisane i dobrze podzielone na moduły. Wiele czasu poświęciliśmy na dyskusje o mikroserwisach, CQRS, event sourcingu, itp. Ale czy można prościej? Postaram się przybliżyć proste podejście do event-driven architecture, wspomnę też o wadach.
The tests are trying to tell you something@VoxxedBucharest.pptxVictor Rentea
If tests are hard to write, the production design is crappy - goes an old saying. Indeed, writing unit tests gives you one of the most comprehensive, yet brutal, feedback about the design of your production code, but if it comes too late, many developers can’t stand it anymore and they will either stop testing or test more superficially. At the other extreme, others struggle to write contrived, fragile tests full of mocks that end up frustrating more than helping them. This talk reviews the main hints that unit tests provide you, from the most obvious improvements to some of the most subtle design principles.
Introduction to GoLang by Amal Mohan N. This presentation is an introduction to GoLang - it's history, features, syntax, importance etc.
concurrency, go-routines, golang, google, gopher, introduction, programming
The slides of my talk "Mockist vs. Classicists TDD" at the Softwerkskammer Berlin Meetup http://www.meetup.com/de-DE/Software-Craftsmanship-Berlin/events/227959647/.
Abstract:
There are two different schools of TDD: the proponents of "London School TDD" ("Mockists") drive their design "outside-in" top-down starting with end-to-end acceptance tests. They focus on the interaction between objects, isolate them with interfaces between them and mock them out in their tests. On the contrary the advocates of "Detroit School TDD" ("Classicists") work bottom-up and try to avoid mocks if possible.
In a live coding session I will demonstrate both approaches and discuss their strengths and weaknesses with you.
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Steve Pember
In this presentation we will present the general philosophy of Clean Architecture, Hexagonal Architecture, and Ports & Adapters: discussing why these approaches are useful and general guidelines for introducing them to your code. Chiefly, we will show how to implement these patterns within your Spring (Boot) Applications. Through a publicly available reference app, we will demonstrate what these concepts can look like within Spring and walkthrough a handful of scenarios: isolating core business logic, ease of testing, and adding a new feature or two.
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Sam Brannen
Attend this talk to learn about the latest and greatest in the world of testing using the Spring Framework and JUnit Jupiter (a.k.a. JUnit 5) including tips for testing with Spring AOT and GraalVM native images.
https://www.youtube.com/live/2XfhoQY9M7g?si=q6rno6xuxeYEYja3
This talk highlights how Angular monoliths can be modularized such that we end up with a scalable architecture. In detail, we cover Nx, Module Boundaries and the Enterprise Monorepo Pattern.
It's usually not enough time for improving comfort of code writing and product monitoring. But this is an important thing for making software products with high quality. IT society even made awesome tools for making our life easier and culture of software engineering continue growing.
Asynchronous API in Java8, how to use CompletableFutureJosé Paumard
Slides of my talk as Devoxx 2015. How to set up asynchronous data processing pipelines using the CompletionStage / CompletableFuture API, including how to control threads and how to handle exceptions.
Real-Time AI: Designing for Low Latency and High Throughput - Dr. Sergei Izra...Sri Ambati
This talk was recorded in London on October 30th, 2018 and can be viewed here: https://youtu.be/CeOJFynB6BE
Real-Time AI: Designing for Low Latency and High Throughput
Bio: Dr. Sergei Izrailev is Chief Data Scientist at Beeswax, where he is responsible for data strategy and building AI applications powering the next generation of real-time bidding technology. Before Beeswax, Sergei led data science teams at Integral Ad Science and Collective, where he focused on architecture, development, and scaling of data science-based advertising technology products. Prior to advertising, Sergei was a quant/trader and developed trading strategies and portfolio optimization methodologies. Previously, he worked as a senior scientist at Johnson & Johnson, where he developed intelligent tools for structure-based drug discovery.
in this webinar, we were discussing about a mikrotik feature that is called metarouter, which can allow us to create an independent virtual router instance. we start the presentation from the introduction of mikrotik and GLC, and then the metarouter. we also do demo and QA and the end of presentation.
the recording is available on youtube: https://www.youtube.com/channel/UCI611_IIkQC0rsLWIFIx_yg
Embracing DevOps through database migrations with FlywayRed Gate Software
"Evolutionary Database Design" is the best phrase to describe database migrations. But what do we know about database migrations using PostgreSQL containers?
This session will provide you with answers and guidelines to get you started with Database DevOps practices for your organization. You will learn the aspects, methods, and strategies to build and manage your database deployments through CI/CD pipelines with open source tools like Flyway, Jenkins, and Kubernetes.
You will be able to build your first database migration through a CI/CD pipeline at the end of this session.
Codemotion Madrid 2023 - Testcontainers y Spring BootIván López Martín
Es 2023 y ya hemos dado por sentado que tenemos que testear nuestras aplicaciones. Escribimos test unitarios sin problemas y somos relativamente felices.
Pero ¿qué ocurre con los tests de integración? ¿Cómo podemos testear con seguridad los diferentes servicios que utilizamos en nuestras aplicaciones Spring?
Testcontainers se integra de manera sencilla y transparente con Spring Boot para ofrecer una experiencia similar a los tests unitarios pero escribiendo tests de integración con servicios reales ejecutados en contenedores: Kafka, Postgresql, MySql, Elasticsearch y cualquier cosa que se pueda ejecutar en Docker.
En esta charla aprenderás cómo utilizar Testcontainers en tus tests de Spring Boot sin sacrificar la velocidad en tu ciclo de desarrollo y aprovechar todo el potencial que ofrece.
The Art of Unit Testing - Towards a Testable DesignVictor Rentea
Slides of the Talk I gave at Devoxx Belgium 2019.
=== Abstract ===
Focusing on the creative work without being terrified of breaking the existing behavior can make software development very addictive! Good automated tests can buy you that!
However, if your tests are not maintainable they may end up slowing you down and causing you painful headaches, compilation errors and spurious failures. To avoid that, your unit tests should be significant; expressive; clean; DRY; non-overlapping; and blazing fast. Writing good tests becomes the toughest challenge for any developer, no matter how battle-hardened: you need to balance risk with test maintenance costs, while looking out for test design smells that call for [risky] refactoring to drive your design towards a set of key principles (included:).
Principles that will end up shaping the way you craft the Production code itself. Because in the end, a good, clean design is more important than coverage%.
But testing gives you the best feedback to get there.
Grab a black coffee and join this snippet from Victor’s Pro Unit Testing #training, to learn about testing priorities, buggy tests, the shared @Before, Mocks vs Stubs and how to reduce them by "purifying" your logic, testing Legacy Code and refactoring @Spy-es out.
All of that in an entertaining, dynamic and memorable session.
Deliberate Practice, New Learning Styles (2015)Peter Kofler
Presentation about Deliberate Practice at the Austrian Testing Board "Expertentreff". This covers the Software Crisis, Developing Quality Software Developers and the mechanisms of Code Katas, Coding Dojos and Code Retreats.
Introduction to GoLang by Amal Mohan N. This presentation is an introduction to GoLang - it's history, features, syntax, importance etc.
concurrency, go-routines, golang, google, gopher, introduction, programming
The slides of my talk "Mockist vs. Classicists TDD" at the Softwerkskammer Berlin Meetup http://www.meetup.com/de-DE/Software-Craftsmanship-Berlin/events/227959647/.
Abstract:
There are two different schools of TDD: the proponents of "London School TDD" ("Mockists") drive their design "outside-in" top-down starting with end-to-end acceptance tests. They focus on the interaction between objects, isolate them with interfaces between them and mock them out in their tests. On the contrary the advocates of "Detroit School TDD" ("Classicists") work bottom-up and try to avoid mocks if possible.
In a live coding session I will demonstrate both approaches and discuss their strengths and weaknesses with you.
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Steve Pember
In this presentation we will present the general philosophy of Clean Architecture, Hexagonal Architecture, and Ports & Adapters: discussing why these approaches are useful and general guidelines for introducing them to your code. Chiefly, we will show how to implement these patterns within your Spring (Boot) Applications. Through a publicly available reference app, we will demonstrate what these concepts can look like within Spring and walkthrough a handful of scenarios: isolating core business logic, ease of testing, and adding a new feature or two.
Testing with Spring, AOT, GraalVM, and JUnit 5 - Spring I/O 2023Sam Brannen
Attend this talk to learn about the latest and greatest in the world of testing using the Spring Framework and JUnit Jupiter (a.k.a. JUnit 5) including tips for testing with Spring AOT and GraalVM native images.
https://www.youtube.com/live/2XfhoQY9M7g?si=q6rno6xuxeYEYja3
This talk highlights how Angular monoliths can be modularized such that we end up with a scalable architecture. In detail, we cover Nx, Module Boundaries and the Enterprise Monorepo Pattern.
It's usually not enough time for improving comfort of code writing and product monitoring. But this is an important thing for making software products with high quality. IT society even made awesome tools for making our life easier and culture of software engineering continue growing.
Asynchronous API in Java8, how to use CompletableFutureJosé Paumard
Slides of my talk as Devoxx 2015. How to set up asynchronous data processing pipelines using the CompletionStage / CompletableFuture API, including how to control threads and how to handle exceptions.
Real-Time AI: Designing for Low Latency and High Throughput - Dr. Sergei Izra...Sri Ambati
This talk was recorded in London on October 30th, 2018 and can be viewed here: https://youtu.be/CeOJFynB6BE
Real-Time AI: Designing for Low Latency and High Throughput
Bio: Dr. Sergei Izrailev is Chief Data Scientist at Beeswax, where he is responsible for data strategy and building AI applications powering the next generation of real-time bidding technology. Before Beeswax, Sergei led data science teams at Integral Ad Science and Collective, where he focused on architecture, development, and scaling of data science-based advertising technology products. Prior to advertising, Sergei was a quant/trader and developed trading strategies and portfolio optimization methodologies. Previously, he worked as a senior scientist at Johnson & Johnson, where he developed intelligent tools for structure-based drug discovery.
in this webinar, we were discussing about a mikrotik feature that is called metarouter, which can allow us to create an independent virtual router instance. we start the presentation from the introduction of mikrotik and GLC, and then the metarouter. we also do demo and QA and the end of presentation.
the recording is available on youtube: https://www.youtube.com/channel/UCI611_IIkQC0rsLWIFIx_yg
Embracing DevOps through database migrations with FlywayRed Gate Software
"Evolutionary Database Design" is the best phrase to describe database migrations. But what do we know about database migrations using PostgreSQL containers?
This session will provide you with answers and guidelines to get you started with Database DevOps practices for your organization. You will learn the aspects, methods, and strategies to build and manage your database deployments through CI/CD pipelines with open source tools like Flyway, Jenkins, and Kubernetes.
You will be able to build your first database migration through a CI/CD pipeline at the end of this session.
Codemotion Madrid 2023 - Testcontainers y Spring BootIván López Martín
Es 2023 y ya hemos dado por sentado que tenemos que testear nuestras aplicaciones. Escribimos test unitarios sin problemas y somos relativamente felices.
Pero ¿qué ocurre con los tests de integración? ¿Cómo podemos testear con seguridad los diferentes servicios que utilizamos en nuestras aplicaciones Spring?
Testcontainers se integra de manera sencilla y transparente con Spring Boot para ofrecer una experiencia similar a los tests unitarios pero escribiendo tests de integración con servicios reales ejecutados en contenedores: Kafka, Postgresql, MySql, Elasticsearch y cualquier cosa que se pueda ejecutar en Docker.
En esta charla aprenderás cómo utilizar Testcontainers en tus tests de Spring Boot sin sacrificar la velocidad en tu ciclo de desarrollo y aprovechar todo el potencial que ofrece.
The Art of Unit Testing - Towards a Testable DesignVictor Rentea
Slides of the Talk I gave at Devoxx Belgium 2019.
=== Abstract ===
Focusing on the creative work without being terrified of breaking the existing behavior can make software development very addictive! Good automated tests can buy you that!
However, if your tests are not maintainable they may end up slowing you down and causing you painful headaches, compilation errors and spurious failures. To avoid that, your unit tests should be significant; expressive; clean; DRY; non-overlapping; and blazing fast. Writing good tests becomes the toughest challenge for any developer, no matter how battle-hardened: you need to balance risk with test maintenance costs, while looking out for test design smells that call for [risky] refactoring to drive your design towards a set of key principles (included:).
Principles that will end up shaping the way you craft the Production code itself. Because in the end, a good, clean design is more important than coverage%.
But testing gives you the best feedback to get there.
Grab a black coffee and join this snippet from Victor’s Pro Unit Testing #training, to learn about testing priorities, buggy tests, the shared @Before, Mocks vs Stubs and how to reduce them by "purifying" your logic, testing Legacy Code and refactoring @Spy-es out.
All of that in an entertaining, dynamic and memorable session.
Deliberate Practice, New Learning Styles (2015)Peter Kofler
Presentation about Deliberate Practice at the Austrian Testing Board "Expertentreff". This covers the Software Crisis, Developing Quality Software Developers and the mechanisms of Code Katas, Coding Dojos and Code Retreats.
Pragmatic Introduction to Python Unit Testing (PyDays 2018)Peter Kofler
We will start with a few best practises for unit testing followed by an interactive, hands-on tour through the main features of Python unit testing framework(s). You will learn while writing tests.
Coding Dojo with focus on naming. Rules of the dojo are Pair Programming & TDD. Constraints are challenges during the dojo. Moving to the extreme is a way of learning. We are coding the game of Tic-Tac-Toe and everything - but the names of test methods - is named using random dices. Specifically using these random dices with enterprise-y useless names.
A Leaderboard shows score of each team. Commit and push green increments to score points. Repeat: Push as often as possible! Try to perform maximum number of smallest steps and test runs.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
Outside-in Test Driven Development - the London School of TDD
1. Outside-in
Test Driven Development
(London School TDD)
Software Quality Days 2019
Peter Kofler, ‘Code Cop’
@codecopkofler
www.code-cop.org
Copyright Peter Kofler, licensed under CC-BY.
2. Peter Kofler
• Ph.D. (Appl. Math.)
• Professional Software
Developer for 20 years
• “fanatic about code quality”
• Independent Code Quality Coach
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
3. I help development teams with
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
●
Professionalism
●
Quality and
Productivity
●
Continuous
Improvement
4. Mentoring
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
●
Pair Programming
●
Programming
Workshops
●
Deliberate
Practice, e.g.
Coding Dojos
8. Your experience with TDD?
●
When and how are you applying TDD?
●
What are you
using every day?
●
Any problems?
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
9. Test-Driven Development is
●
a programming practice in which all
production code is written in response
to a failing test.
●
a practice for designing and coding
software applications.
●
not a replacement for testing.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
11. TDD Cycle
●
add a test
●
run all tests and see if the new one fails
●
write little code
●
run all tests and see them succeed
●
refactor code mercilessly
●
repeat
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
12. Uncle Bob’s 3 Laws of TDD
●
You are not allowed to write any ...
●
… production code
unless to make a failing test pass.
●
… more of a unit test
than is sufficient to fail the test.
●
… more production code
than is sufficient to pass the test.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
http://butunclebob.com/ArticleS.UncleBob.TheThreeRulesOfTdd
13. How do we design using TDD?
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
14. e.g. Scanning Numbers
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
●
We need to scan
documents.
●
Documents
contain numbers.
●
Numbers consist
of digits.
16. Scanning Numbers #1
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
●
Classic TDD aka
“Chicago” or
“Detroit School”
●
Inside-out =
working from
„bottom“ up
17. Scanning Numbers #2
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScannerTest
18. Scanning Numbers #3
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScannerTest
Test
19. Scanning Numbers #4
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScannerTest
Test
Test
20. Summary of Classic TDD
Working from „bottom“ up
Collaborators usually not mocked
(just used)
State-based tests
Emergent design during refactoring
Avoids over-engineering
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Franziska Sauerwein, http://slides.com/franziskasauerwein/outside#/
22. Scanning Numbers #1
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
●
Mockist TDD aka
“London School”
●
Outside-in =
following the
user interaction
23. Outside-In
●
build the system from the "outside-in"
●
helps identify top level function/class,
entry point to the desired functionality,
●
e.g. widget in GUI, link on a
web page, or command line flag
●
following the user interaction
through all the parts of the system
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
24. Scanning Numbers #2
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
Test
Mock
25. Mock
Scanning Numbers #3
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Scanner
NumberScanner
DigitScanner
Test
Mock
Test
27. Summary of Outside-In TDD
Working from „outside“ in.
Assume collaborators and mock them.
Verify behaviour, not state.
Design in Red stage.
Follow Tell-Don't-Ask principle.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Franziska Sauerwein, http://slides.com/franziskasauerwein/outside#/
29. Five Types of Test Doubles
●
Dummy (Object)
●
Fake (Object)
●
Stub
●
Partial Stub
●
Spy
●
Mock
●
Partial Mock
●
Test-Specific Subclass
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
30. How to “Mock” an Object
●
by hand
●
implement its interface (Eclipse Ctrl-1)
●
subclass it (beware complex constructors)
●
with java.lang.reflect.Proxy
●
since Java 1.3
●
only for interfaces
●
nasty for more than 1 method
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
31. Mocking Frameworks
●
e.g. Mockito, moq, Sinon.JS, ...
●
mock interfaces (Proxy)
●
mock non final classes (cglib)
import static org.easymock.EasyMock.*;
SomeInt mock = createMock(SomeInt.class);
expect(mock.someMethod("param")).andReturn(42);
replay(mock);
// run the test which calls someMethod once
verify(mock);
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
34. Write a failing end-to-end test
Nathaniel Pryce, http://www.doc.ic.ac.uk/~np2/teaching/
35. Double Loop TDD
Design Process
●
create an Acceptance/Guiding Test (red)
●
start with top level interaction (from UI)
●
discover/design needed collaborators
●
stub/mock these dependencies
●
implement using TDD
●
run Guiding Test to see where to go next
●
while Guiding Test is still red
●
move down to previously mocked collaborator
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
Emily Bache, http://coding-is-like-cooking.info/2013/04/outside-in-development-with-double-loop-tdd/
44. Coding Dojo Mindset
●
Safe place outside
work
●
We are here to learn
●
Need to slow down
●
Focus on doing it right
●
Collaborative Game
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
46. Bank OCR
●
You work for a bank, which has a machine to assist in reading
letters. The machine scans the paper documents, and produces
a file with a number of entries which each look like this:
····_··_·····_··_··_··_··_·
··|·_|·_||_||_·|_···||_||_|
··||_··_|··|·_||_|··||_|·_|
●
Each entry is 4 lines long, each line has 27 characters. The first
3 lines contain an account number written using pipes and
underscores, and the fourth line is blank. Each account
number should have 9 digits, all of which should be in the
range 1-9.
●
Write a program that can take this file and parse it into actual
account numbers.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
47. Prepare
● Find a pair.
● Agree on a programming language.
● Get the project from
https://bitbucket.org/pkofler/bankocr-kata-setup
● See GuidingTest (failing test)
● Guiding Test is the starting point.
● Work through outer API, outside-in.
● Implement Bank OCR.
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
48. Recommended: A Test List
●
Use first ten minutes to
create list of acceptance
test cases (on paper)
●
Start each TDD cycle with
at least three test cases
before beginning to code
(paper or text file)
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
49. Apply: Outside-In TDD
●
build the system from the "outside-in",
following the user interaction
through all the parts of the system
●
create a Guiding Test
●
start with top level interactions
●
mock dependencies
●
implement using TDD until all tests green
●
move inside previously mocked collaborator
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
52. Closing Circle
●
What did you learn today?
●
What surprised you today?
●
What will you do
differently in the
future?
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY