Common Challenges & Best Practices for TDD on iOSDerek Lee Boire
Presented at the June 2016 Tokyo iOS Meetup on 6/11/2016, in this presentation I give an overview of test driven development and how it can be used when developing for iOS / Swift.
TDD is an enormous topic so this really just scratches the surface to give an expansive glimpse into the journey that TDD truly is. Those unfamiliar with TDD will hopefully have a desire to learn more about it while those familiar will hopefully learn something new.
This workshop is designed specially for Queen Mary University of London alumni, in order to teach them TDD.
You will learn: What is TDD, Why and How.
If you want to learn more: https://github.com/MyPitit/TDD
Common Challenges & Best Practices for TDD on iOSDerek Lee Boire
Presented at the June 2016 Tokyo iOS Meetup on 6/11/2016, in this presentation I give an overview of test driven development and how it can be used when developing for iOS / Swift.
TDD is an enormous topic so this really just scratches the surface to give an expansive glimpse into the journey that TDD truly is. Those unfamiliar with TDD will hopefully have a desire to learn more about it while those familiar will hopefully learn something new.
This workshop is designed specially for Queen Mary University of London alumni, in order to teach them TDD.
You will learn: What is TDD, Why and How.
If you want to learn more: https://github.com/MyPitit/TDD
San Francisco Software Craftsmanship Meetup
Test Driven Developers Bay Area Meetup
TDD Flow: The Mantra in Action” is a talk + hands-on about the mantra of TDD and its core patterns. Here are some questions for this talk: What is TDD? How to write a good test that fails? How to write code enough to make the test pass? How to remove duplication? How to refactor code? How to create clean code? Is TDD about testing or design? How small should a test be? Should I only write unit tests? Should I estimate TDD? How to use TDD with other agile methods like Scrum, Kanban or BDD? And finally, how to flow in TDD?
4 Nisan 2015 tarihinde Kadir Has Üniversitesi'nde yapılan 9. Yazılım Teknolojileri Seminer etkinliğinde Eralp Erat'ın yaptığı TDD (Test Driven Design) sunumu
Test Driven Development - Phương pháp phát triển phần mềm theo hướng viết test trước.
Áp dụng TDD sẽ đem lại cho bạn thiết kế phần mềm trong sáng hơn và quản lý được chất lượng từng dòng code của mình viết ra.
Bài trình bày của bạn Lê Anh tại Meetup của Ha Noi .NET Group.
Chi tiết vui lòng xem tại: http://tungnt.net
Test-Driven Development is about approaching software development from a test perspective and knowing how to use the tools (e.g. JUnit, Mockito) to effectively write tests.
Source code examples @...
https://github.com/codeprimate-software/test-driven-development
Lightening Talk I gave at Inaka in May 2014.
This is sort of the continuation of my previous iOS TDD talk.
Since TDD and DI go quite hand in hand and they are both extend concepts to learn in one shot, I had to prepare a completely separated talk for spreading to my fellows the DI knowledge I had acquired.
Slides from the session "TDD - That Was Easy!" presented by Fadi Stephan from Kaizenko at AgileDC2019 on September 23, 2019 in Washington DC. A blog post accompanying this talk will be published soon on kaizenko.com
Abstract:
Have you tried TDD? Do you hate it? Do you have a hard time applying it in practice? Do you find it promoting bad design decisions because you must write micro tests instead of looking at the big picture? Are your tests tightly coupled to the implementation due to a lot of mocking making refactoring a pain? Do tons of tests break when a simple change is made? Do you have a hard time justifying all the time spent on writing tests vs. just focusing on development?
You are not alone. Every organization or team that I run into is supposedly Agile. Some are also applying agile engineering practices such as automated unit, integration and acceptance testing, etc… However, many struggle with TDD. TDD is hard, seems counter-intuitive and requires a lot of investment. Come to this session for a TDD reboot. We will look at the benefits of TDD, discuss the resistance to TDD and uncover some common difficulties along with misconceptions. We will address these misunderstandings and explore different approaches to making TDD easier. Leave with a fresh perspective and new insights on how to become better at TDD and apply it with ease
San Francisco Software Craftsmanship Meetup
Test Driven Developers Bay Area Meetup
TDD Flow: The Mantra in Action” is a talk + hands-on about the mantra of TDD and its core patterns. Here are some questions for this talk: What is TDD? How to write a good test that fails? How to write code enough to make the test pass? How to remove duplication? How to refactor code? How to create clean code? Is TDD about testing or design? How small should a test be? Should I only write unit tests? Should I estimate TDD? How to use TDD with other agile methods like Scrum, Kanban or BDD? And finally, how to flow in TDD?
4 Nisan 2015 tarihinde Kadir Has Üniversitesi'nde yapılan 9. Yazılım Teknolojileri Seminer etkinliğinde Eralp Erat'ın yaptığı TDD (Test Driven Design) sunumu
Test Driven Development - Phương pháp phát triển phần mềm theo hướng viết test trước.
Áp dụng TDD sẽ đem lại cho bạn thiết kế phần mềm trong sáng hơn và quản lý được chất lượng từng dòng code của mình viết ra.
Bài trình bày của bạn Lê Anh tại Meetup của Ha Noi .NET Group.
Chi tiết vui lòng xem tại: http://tungnt.net
Test-Driven Development is about approaching software development from a test perspective and knowing how to use the tools (e.g. JUnit, Mockito) to effectively write tests.
Source code examples @...
https://github.com/codeprimate-software/test-driven-development
Lightening Talk I gave at Inaka in May 2014.
This is sort of the continuation of my previous iOS TDD talk.
Since TDD and DI go quite hand in hand and they are both extend concepts to learn in one shot, I had to prepare a completely separated talk for spreading to my fellows the DI knowledge I had acquired.
Slides from the session "TDD - That Was Easy!" presented by Fadi Stephan from Kaizenko at AgileDC2019 on September 23, 2019 in Washington DC. A blog post accompanying this talk will be published soon on kaizenko.com
Abstract:
Have you tried TDD? Do you hate it? Do you have a hard time applying it in practice? Do you find it promoting bad design decisions because you must write micro tests instead of looking at the big picture? Are your tests tightly coupled to the implementation due to a lot of mocking making refactoring a pain? Do tons of tests break when a simple change is made? Do you have a hard time justifying all the time spent on writing tests vs. just focusing on development?
You are not alone. Every organization or team that I run into is supposedly Agile. Some are also applying agile engineering practices such as automated unit, integration and acceptance testing, etc… However, many struggle with TDD. TDD is hard, seems counter-intuitive and requires a lot of investment. Come to this session for a TDD reboot. We will look at the benefits of TDD, discuss the resistance to TDD and uncover some common difficulties along with misconceptions. We will address these misunderstandings and explore different approaches to making TDD easier. Leave with a fresh perspective and new insights on how to become better at TDD and apply it with ease
This slide is for Ultimate Agilist Tokyo in Japan. 2012.Nov.
I want to think about agile programmer's skill set. and I want to introduce ICAgile to Japan.
I analyzed agile value, principles, practices and ICAgile.
and participant members created some mandatory skill set in this session.
See this blog entry , that will be better.
http://simple-architect.blogspot.jp/2012/11/agile-programmers-skill-set-ultimate.html
[db tech showcase Tokyo 2016] D24: データベース環境における検証結果から理解する失敗しないフラッシュ活用法 第三章 ~デ...Insight Technology, Inc.
フラッシュのGB単価はHDDと並び、オールフラッシュ導入が加速化する一方、インラインでの重複排除、圧縮機能のオーバーヘッド、メンテナンス / 障害時の影響など、気をつけなければいけない事は沢山あります。本セッションでは、オールフラッシュ製品(Pure Storage)上でOracle Databaseを稼働させた検証結果と生のデモンストレーションをベースに、DB on Pure Storageならではの活用法を考えます。
No one can predict unforeseen killer applications enabled by new wireless technologies (e.g., 5G network) beforehand. Looking back 20-year history of mobile wireless network, it has been very tough to prepare killer applications a prior to the emergence of new radio access technologies. NTT DOCOMO’s i-mode was not prepared for 2G always-on network., and invented after that. Smartphones with application markets became popular after the 3G network deployment, for which video conversation had been prepared a a killer service candidate and which didn’t make a success. 4G network brought us more capacity and low latency network, while youtube, hulu, Netflix, facebook messenger and others were natured by such a rich mobile communication environment with cloud platforms.
Everyone, nowadays, are talking about a buzz word “IoT” without having a solid idea for monetization. Such a bold discussion may mislead our radio access technology development to an unpromised land.
My recommendation is “Decide as late as possible, particularly for decisions that are irreversible.” According to software engineering terminology, it says also “late binding.” Don’t rush into a 10Gps broadband network nor a hyper low latency and 0% packet-loss assured network.
Having said that, the 5G beam forming radio technology (enabled by Massive MIMO) will bring a unique communication characteristics with a more reliable, higher capacity and 3D-positioning. My bet on 5G killer applications is “Night Golf” where you can play golf without seeing a ball which is being identified by the 5G radio. haha.
Ever tried doing Test First Test Driven Development? Ever failed? TDD is not easy to get right. Here's some practical advice on doing BDD and TDD correctly. This presentation attempts to explain to you why, what, and how you should test, tell you about the FIRST principles of tests, the connections of unit testing and the SOLID principles, writing testable code, test doubles, the AAA of unit testing, and some practical ideas about structuring tests.
TDD is now mainstream but a lot people don't know or don't remember what is its purpose. TDD is about software design not testing or catching bug. TDD helps developers to shape and create software with "good" design, what is a "good" design is something that we will discuss in the topic.
Developer Tests - Things to Know (Vilnius JUG)vilniusjug
There are many great talks that discuss challenges developers face when writing software tests. In this talk let's look at test design problems that may seem to be simple but yet fundamentally important and often misunderstood even by experienced programmers.
Test Driven Development - The art of fearless programmingChamil Jeewantha
Test Driven Development is nothing more than "Unit Testing" but an art of unit testing. Arts require lots of practice.
To start with TDD, it is very important to understand what is unit testing. The common problem many coders have is "Not understanding what is a unit". This presentation targets to solve this basic problem than going behind non-understandable jargons.
Seconda serata di introduzione al Test-Driven Development, tenuta in XPeppers a Trento il 24 Ottobre 2012.
Nelle slide c'è anche la descrizione del coding dojo sullo string calculator che abbiamo svolto assieme.
How to improve your skills and how to apply for a jobChristian Hujer
For the Student Developer Day at the ACHS (Asian College of Higher Studies) in Kathmandu, Nepal, I gave a talk about how to improve your skills and how to apply for a job. But I first used the opportunity to talk about the waste pyramid.
The slides of my talk about Vertical vs Horizontal Software Architecture at Equal Expert's Expert Talks Pune on 2019-09-14. It describes why vertical architectures are better than horizontal architectures for the perspective of change and architecture principles, and how this should reflect in the structure of source code.
Why Agile is incompatible with Matrix organizations, the collateral damage that Matrix organizations exert on their projects and products, and how to break these things. Some highlights: Cross-functional teams, Tuckman's Stages of Team Formation, Test Automation Pyramid.
I've given this talk at the Agile Network India meetup on 2019-07-27.
Scrum is incomplete. It's a framework. It's gaps become blatantly visible when trying to map the Agile Principles. Extreme Programming can fill these gaps.
2016-04-22: Beyond SOLID: The Package PrinciplesChristian Hujer
Reprise: The four design smells (Rigidity, Fragility, Immobility, Viscosity)
SOLID reprise: Quick overview of the first five principles
SRP Update: It's not just about classes!
Package Cohesion Principles:
* Release-Reuse Equivalency Principle (REP)
* Common Closure / Cohesion Collocation Principle (CCP)
* Common Reuse Principle (CRP)
Package Coupling Principles:
* Acyclic Dependencies Principle (ADP)
* Stable Dependencies Principle (SDP)
* Stable Abstractions Principle (SAP)
Mnemonics for remembering them: ACCESS, CASE
And don't forget Robert "Uncle Bob" C. Martin!
This is the original Google Drive slides:
https://docs.google.com/a/nelkinda.com/presentation/d/1yEOCYWhIgMfiDAJYtvB5ongE2qvcA91tPqLB4TzEcwM/edit?usp=sharing
Vertical vs horizontal software architecture ruby conf india 2016Christian Hujer
Lightning talk Vertical vs Horizontal Software Architecture held at RubyConf India 2016 in Kochi, Kerala, India. Covers a few architecture principles to describe why vertical architectures are more maintainable than horizontal architectures.
The Transformation Priority Premise is a tool invented by Robert “Uncle Bob” C. Martin that helps in discovering the sequence in which to write unit tests and production code in Test-Driven Development. This talk gives an overview of the Transformation Priority Premise - and Aliens.
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Experience our free, in-depth three-part Tendenci Platform Corporate Membership Management workshop series! In Session 1 on May 14th, 2024, we began with an Introduction and Setup, mastering the configuration of your Corporate Membership Module settings to establish membership types, applications, and more. Then, on May 16th, 2024, in Session 2, we focused on binding individual members to a Corporate Membership and Corporate Reps, teaching you how to add individual members and assign Corporate Representatives to manage dues, renewals, and associated members. Finally, on May 28th, 2024, in Session 3, we covered questions and concerns, addressing any queries or issues you may have.
For more Tendenci AMS events, check out www.tendenci.com/events
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Navigating the Metaverse: A Journey into Virtual Evolution"Donna Lenk
Join us for an exploration of the Metaverse's evolution, where innovation meets imagination. Discover new dimensions of virtual events, engage with thought-provoking discussions, and witness the transformative power of digital realms."
Enterprise Resource Planning System includes various modules that reduce any business's workload. Additionally, it organizes the workflows, which drives towards enhancing productivity. Here are a detailed explanation of the ERP modules. Going through the points will help you understand how the software is changing the work dynamics.
To know more details here: https://blogs.nyggs.com/nyggs/enterprise-resource-planning-erp-system-modules/
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I didn't get rich from it but it did have 63K downloads (powered possible tens of thousands of websites).
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
RISE with SAP and Journey to the Intelligent Enterprise
2016 10-04: tdd++: tdd made easier
1. TDD++: TDD Made Easier
2016-10-04 OX:AGILE Meetup @Elsevier
Christian Hujer, Software Craftsman
(Nelkinda Software Craft, Equal Experts)
2. Topics
● Definitions of Unit Testing
● Definitions of (A)TDD
● How (A)TDD relates to XP, Agile, Software Craftsmanship
● How (A)TDD relates to software architecture
● The Three Laws of TDD
● Unit Test vs Acceptance Test / White Box vs Black Box / Bottom-Up vs
Top-Down: When to use which approach
● The 4 A’s — Arrange, Act, Assert, Annihilate
● BDD
● The Anatomy of xUnit Frameworks (JUnit, AceUnit)
● Cucumber, Gherkin
● TPP
4. When did you learn programming?
When did you learn about TDD?
How many years of difference?
Is Test-Development the same as Production-
Development? What is different?
Ask yourself
5. TDD can be hard because …
●… writing tests is somewhat different from
writing production code.
●… we have much less experience in writing
tests than writing production code.
●… we don’t know rules, laws, guidelines,
principles.
●… we might follow bad practices.
10. “The secondary value of Software is its behavior:
That it does what the current users currently need
without any bugs, crashes or delays.”
— Robert C. Martin
⇒ But: Users and their needs change with time!
Secondary Value of Software
11. Primary Value of Software
“The ability of software to tolerate and facilitate
such ongoing change is the primary value of
software. The primary value of software is that it’s
soft.”
— Robert C. Martin
12. Refactoring
Refactoring, n:
A change to the structure of source code
without significantly changing its behavior.
But what defines what change in behavior is
significant?
17. What’s a Test?
A Test is an Executable Specification of
Relevant Behavior.
A Test operates by Observation of Behavior.
18. “Unit Tests are tests that run fast.”
— Michael Feathers,
Working Effectively with Legacy Code
What are Unit Tests?
19. Acceptance Test
Tests on the level of a system’s users.
Ideally they match acceptance criteria of user
stories.
Pro Tip: Write Acceptance Criteria in Gherkin!
20. White / Black / Grey Box
Good Unit Tests are Grey Box Tests.
(Or Black Box Tests on Class Level.)
Full White Box results in tight coupling between
Test and Implementation.
21. ●Do not couple your unit tests to your
implementation or environment.
●Clean Code, SOLID and package principles,
DRY also apply to tests.
●Do not test private methods.
(Unit) Tests are System Components
22. Low Code Coverage ⇒ Low Requirements Coverage
⇒ Low Code Coverage is a strong metric.
High Code Coverage ⇏ High Requirements Coverage
⇒ High Code Coverage is a weak metric!
Execution is not sufficient.
Verification is essential!
Coverage
23. How to find that your test is useless
Sabotage your production
code to find useless tests.
If replacing a complex
implementation with
return "";
still passes, you’ve mocked
yourself away!
24. Regression Test
●Regression Test is NOT another type of test!
●Regression Test is the repeated execution of
tests in order to prevent regression.
●But: Regression Tests can be those tests
found to not change for a new feature.
29. ●Kent Beck (SUnit) & Erich Gamma (Java)
●Standard for future frameworks
●xUnit (examples: NUnit, TestNG, CUnit,
CppUnit, EmbUnit, AceUnit)
JUnit History
30. What JUnit Provides
Test Runner Framework
Test Logging / Reporting Framework
Default Test Runner
Default Test Loggers
Automated Test Discovery (!)
Assertion Framework
31. JUnit Example
1 import org.junit.Test;
2 import static org.junit.Assert.*;
3
4 public class StringsTest {
5 @Test
6 public void nullHasLengthZero() {
7 assertEquals(0, Strings.length(null));
8 }
9 }
33. JUnit Execution Sequence
1 public class MyTest {
2 @BeforeClass
3 public static void beforeClass() {}
4 @AfterClass
5 public static void afterClass() {}
6 @Before
7 public void before() {}
8 @After
9 public void after() {}
10 @Test
11 public void test1() {}
12 @Test
13 public void test2() {}
14 }
1. beforeClass()
2. new MyTest()
3. before()
4. test1()
5. after()
6. new MyTest()
7. before()
8. test2()
9. after()
10.afterClass()
34. Original:
“A class should have should have only one reason to change.”
— Robert C. Martin
New:
On its level of abstraction, a software entity should have
only one reason to change.
SRP Revisited
35. Single Assert Rule
Every Test Case should contain only one logical assert.
Multiple assert statements are possible if they are one
assertion on a logical level.
SRP - Single Responsibility Principle applies here as well.
36. The 4 A’s
A test case consists of 4 Steps:
●Arrange
●Act
●Assert
●Annihilate
39. Do Not compare boolean values
Bad
assertEquals(false, v);
assertEquals(true, v);
assertTrue(v == true);
assertFalse(v == true);
Good
assertTrue(v);
assertFalse(v);
40. Do separate A’s with blank lines
1 @Test
2 public void blinker() {
3 Universe horizontalBlinker = parse("...nOOO");
4 Universe verticalBlinker = parse(".On.On.O");
5
6 Universe actual = horizontalBlinker.step();
7
8 assertEquals(verticalBlinker, actual);
9 }
41. Do not log test steps
1 @Test
2 public void someTest() {
3 LOG.debug("Starting someTest().");
4 // …
5 LOG.debug("End of someTest().");
6 }
⇒ Pointless duplication of test runner functionality.
⇒ Silence is Golden (ancient UNIX wisdom).
⇒ Only make noise when crashing, but then make a lot!
⇒ If it’s so long that it has steps, it violates the SRP.
42. Do Make Given When Then Explicit
1 @Test
2 public void blinker() {
3 // Given
4 Universe horizontalBlinker = parse("...nOOO");
5 Universe verticalBlinker = parse(".On.On.O");
6
7 // When
8 Universe actual = horizontalBlinker.step();
9
10 // Then
11 assertEquals(verticalBlinker, actual);
12 }
43. Disabling Tests
Don’t comment out
1 // Takes too long
2 // @Test
3 public void someTest() {
4 // ...
5 }
Use @Ignore
1 @Ignore("Takes too long")
2 @Test
3 public void someTest() {
4 // ...
5 }
Disabled Tests are an Abomination!
(Almost like commented-out code.)
44. Don’t force OO without reason
1 class Strings {
2 int length(String s) {
3 return s != null
4 ? s.length()
5 : 0;
6 }
7 }
1 class Strings {
2 static int length(String s) {
3 return s != null
4 ? s.length()
5 : 0;
6 }
7 }
45. Don’t force OO without reason
1 class StringsTest {
2 @Test
3 void nullIsZero() {
4 Strings s;
5 s = new Strings();
6 assertEquals(0,
7 s.length(null));
8 }
9 }
1 class StringsTest {
2 @Test
3 void nullIsZero() {
4 assertEquals(0,
5 Strings.length(null));
6 }
7 }
46. Unit Tests are System Components
●Do not test private methods.
●Do not couple your unit tests to your
implementation.
52. The 3 Laws of TDD
1. You are not allowed to write any production code unless it is
to make a failing unit test pass.
2. You are not allowed to write any more of a unit test than is
sufficient to fail; and not compiling is failing.
3. You are not allowed to write any more production code than
is sufficient to pass the one failing unit test.
— Robert C. Martin
53. The Red-Green-Refactor Cycle
Red: Write as much of test
as is sufficient to fail.
Green: Write as much of
production code as is
sufficient to pass.
Refactor: Well, refactor!
54. TDD + Pair Programming: Ping Pong
1.Dev 1 Drives Red: Test Case
2.Dev 2 Drives Green: Production Code
3.Dev 2 Drives Blue: Refactor
4.Dev 2 Drives Red: Test Case
5.Dev 1 Drives Green: Production Code
6.Dev 1 Drives Blue: Refactor
⇒ Repeat
56. ●Much less Debugging
●Courage (required for Refactoring mercilessly)
●Documentation (executable Specs)
●Design
●Professionalism
— Robert C. Martin
Also: Trades Fragility into Rigidity!
Benefits of TDD
57. Importance of Test Code
You have 2 drives:
1.Production Code
2.Test Code
Somehow Backups are unavailable.
Which hard drive do you wish got lost?
58. Importance of Test Code
●Treat Test Code with at least as much care
and principles as the production code.
●That is, Clean Code, SOLID, DRY, Law of
Demeter etc. all apply!
60. The Future Paths of Code
Project 1:
●Excellent Design
●No Tests
Project 2:
●Poor Design
●Lots of Tests
What will be the future of these projects?
61. TDD and Functional Programming
Functional Programming: Programming without
variable (re-)assignments.
⇒ Immutable Objects
⇒ Pure Functions
Immutable Objects and Pure Functions are
easier to test!
64. Ontology of Test Doubles
TestDouble
Dummy
Stub
Spy
Mock
Fake
Original
replaces
65. Original has any of these characteristics:
●Non-deterministic results (time, temperature)
●States are difficult to reproduce
●Slow
●Does not (yet) exist
●Impedes testing
⇒ “Because I can” is not on the list!
⇒ “To isolate the test class” is not on the list!
Reasons for Using Test Doubles
66.
67. Mocking can…
●…deteriorate test focus,
●…violate the Law of Demeter,
●…lead to fragile tests,
●…lead to worthless tests,
●…be harmful!
⇒ So use mocking judiciously!
Conclusions from Case Study
68. ●Rigorously mock all external dependencies!
●Use mocking judiciously!
○Mocking might make you lose test focus.
●If the real code couldn’t pass the test in
place of the mock, the mock is wrong!
Guidelines for Mocking in Unit Tests
69. Guidelines for Dependency Injection
Use Dependency Injection judiciously!
Inject dependencies for Strategies and
Singletons, but not just because you can!
There’s nothing wrong with “good old concepts”
like static methods when they perfectly well do
the job!
70. Other
Classes can depend on functionality of other
classes in two ways:
●Loosely coupled, as in Aggregation
⇒ Mocks are useful
●Tightly coupled, as in Composition
⇒ Mocks are harmful
72. BDD — Behavior-Driven Development
Extension of TDD that makes use of a simple,
domain-specific language (usually around the
words “given”, “when”, “then”).
73. BDD - Behavior Driven Development
Arrange: Given
Act: When
Assert: Then
(Annihilate: Hidden nicely in the background)
74. 4 A’s ≘ BDD
Arrange
Act
Assert
(Annihilate)
Given
When
Then
78. Gherkin Example
1 Scenario: As a User, I want to start the editor
2 Given I have just started the editor
3 Then the document name must be "<Unnamed>"
4 And the editor has focus
5 And the document must have the following content:
6 """
7 """
8 And the window title must be "Editor: <Unnamed>"
79. Feature: Delivery Date Prediction
Scenario: Ordering on a workday before cutoff time.
Given product id 1234 with cutoff time 13:00.
Given the current datetime is 2016-01-02T12:59.
Given DHL is my default delivery service.
When viewing that product,
Then the displayed delivery date is 2016-01-03.
Gherkin
80. 1 Scenario: As a User, I want to load a file
2 Given I have just started the editor
3 And the file "foo.txt" has the following content:
4 """
5 Hello, World!
6 """
7 When I action "open"
8 Then I must be asked for a filename
9 When I enter the filename "foo.txt"
10 And I wait for I/O to be completed
11 Then the document must have the following content:
12 """
13 Hello, World!
14 """
15 And the document name must be "foo.txt".
82. Feature Files: *.feature
1 Feature: Simple Calculator Usage
2 Background:
3 Given the initial state of the calculator
4
5 Scenario: Add two numbers
6 When I press "10+10="
7 Then the result on the display is "20"
8
9 Scenario: Multiplying three numbers
10 When I press "2*3*4="
11 Then the result on the display is "24"
83. 1 Feature: Calculator
2 Scenario Outline: Adding numbers
3 Given my current state is cleared,
4 When I enter the "<first number>",
5 And I press "+",
6 And I enter the "<second number>",
7 And I press "=",
8 Then the result must be "<sum>".
9 Examples:
10 | first number | second number | sum |
11 | 10 | 20 | 30 |
12 | 20 | 5 | 25 |
13 | 30 | 1 | 31 |
Scenario Outline Example
84. Smartness simplifies your life
1 Feature: Calculator
2 Scenario Outline: Performing Calculations
3 When I enter "<input>"
4 Then the result must be "<output>"
5 Examples:
6 | input | output |
7 | 1+1= | 2 |
8 | 2*3*4= | 24 |
9 | 2^2^2= | 16 |
10 | 5! | 120 |
85. Gherkin Tips
●Be Concise.
●Use “must” for verifications that must not fail.
●Prefer Scenario Outlines over Scenarios.
●Reuse StepDefs as much as possible.
●Ignore punctuation at the end (comma, full
stop).
86. Compare and discuss pros / cons
1 Given a property id:"pii:42" key:"sa:userLicense" with the
following value exists:
2 """
3 foo
4 """
1 Given I POST the following payload to
"/properties/pii/id:42?key=sa:userLicense":
2 """
3 foo
4 """
89. Step Definitions
1 package …;
2
3 public class EditorStepdefs {
4 @Given("^I have just started the editor$")
5 public void iHaveJustStartedTheEditor() { /* … */ }
6
7 @When("^I action "([^"]*)"$")
8 public void iAction(String actionCommand) { /* … */ }
9
10 @Then("^the document must have the following content:$")
11 public void expectDoc(String text) { /* … */ }
12 }
91. ●Make StepDefs as reusable as possible.
●Don’t group StepDefs by Features.
●Group StepDefs by Topics / Dependencies.
Cucumber Tips
92. Cucumber Java 8
1 import cucumber.api.PendingException;
2 import cucumber.api.java8.En;
3 public class MyStepdefs implements En {{
4 Given("^product id (d+) with cutoff time (d+:d+)[.,]?$", (String id, String time) -> {
5 throw new cucumber.api.PendingException();
6 });
7 Given("^the current datetime is (d+-d+-d+Td+:d+)[.,]?$", (String datetime) -> {
8 throw new PendingException();
9 });
10 Given("^"([^"]+)" is my default delivery service[.,]?$", (String deliveryService) -> {
11 throw new PendingException();
12 });
13 When("^viewing that product[.,]?$", () -> {
14 throw new PendingException();
15 });
16 Then("^the displayed delivery date is (d+-d+-d+)[.,]?$", (String expectedDeliveryDate) -> {
17 throw new PendingException();
18 });
19 }}
93. ●Syntax Highlighting of Feature Files
●Matching of steps and step definitions
●Completion of keywords
●Completion of steps
●Creation of stub step definitions (Groovy,
Java, Java 8)
●Cucumber Test Execution
●JUnit Test Execution
Support in IntelliJ IDEA
94. Make Gherkin Successful
Involve Product Owner / Business Analysts
Reusable Step Definitions
⇒ This requires constant attention!
95. Successful Usage of Cucumber…
…requires a lot of discipline from…
●…authors of feature files
●…developers providing step definitions
To ensure consistency across the whole
project.
⇒ Cucumber is an art!
97. TPP — Transformation Priority Premise
Premise that production code is evolved best
by writing tests which demand applying
transformations in a specific sequence.
99. TPP - Transformation Priority
Premise
“As the tests get more specific, the code
gets more generic.”
— Robert C. Martin
100. List of Transformations
1. {} → nil
2. nil → constant
3. constant → constant +
4. constant → scalar
5. statement → statements
6. unconditional → if
7. scalar → array
8. array → container
9. statement → recursion
10.if → while
11.expression → function
12.variable → assignment
101. TPP Applied
Start: Define the most degenerate good case.
Induction: Demand the simplest transformation
possible.
102. How it works
●The first unit test should demand the first
transformation.
●The next unit test should demand the
simplest next transformation possible.
●Apply the simplest transformations that still
satisfy the test.
●And: Red → Green → Refactor
104. ●Integration Tests that don’t Integrate?!
●Separate Regression Tests???
(All Tests are Regression Tests!)
●And Mocking / Mockito is totally overused!
Where are your skills for abstraction?
Are we out of our mind?!
105. Possible Future Meetup Topics
● The SOLID Principles
● Beyond SOLID: Package Principles
aka Vertical vs Horizontal Architecture
● JUnit 5
● BDD with Gherkin and Cucumber-JVM
● Cucumber-Java8
● Mocking with Mockito
● SVG — Scalable Vector Graphics
106. Possible Future Meetup Topics
● Clean Code Refactoring: Expense Report Example
● TDD: Bowling Game Example
● (A)TDD Swing Text Editor Example
● (A)TDD Web server Example
● Functional Programming in Java 8
● Functional Programming (3 Parts)
● Unicode and Character Encodings
● Transformation Priority Premise
107. Possible Future Meetup Topics
● The UNIX Way To The Web — GNU make, XSLT and
NetPBM to generate stunningly fast XHTML5
● How to increase the Quality of your Website
● C and Embedded TDD with AceUnit (on Arduino and
Raspberry Pi)
109. 2016-10-22 Global Day of Coderetreat
●More than 150 cities worldwide
●https://www.meetup.com/Agile-Software-
Development-
Oxfordshire/events/234142930/