This document provides an introduction to test-driven development (TDD). It discusses the benefits of unit testing over end-to-end testing, including error localization, execution time, tighter feedback loops, and test coverage. It defines what constitutes a unit test and what does not. Examples of difficult scenarios to unit test are given. The basic TDD cycle of writing a failing test, making the test pass, and refactoring is explained. An exercise demonstrates applying TDD principles. Mock objects and the differences between the Chicago and London schools of TDD are briefly covered. Finally, additional resources on TDD are listed.
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?
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
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?
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
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
Lightening Talk I gave at Inaka in April 2014.
I was in charge of investigating test-driven development for our iOS mobile team. Since I realized it was such a big concept, after having gathered enough information and having played with it enough, I decided to introduce my fellows on the topic by presenting it in a formal talk with slides. The aim was teaching them a different way of developing, which, for us, at that moment, was completely new and controversial.
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
Getting Unstuck: Working with Legacy Code and DataCory Foy
From this presentation for the IASA in 2007, Cory covers common challenges in dealing with Legacy Code and Data, and some tools and techniques for handling them.
Unit testing and test-driven development are practices that makes it easy and efficient to create well-structured and well-working code. However, many software projects didn't create unit tests from the beginning.
In this presentation I will show a test automation strategy that works well for legacy code, and how to implement such a strategy on a project. The strategy focuses on characterization tests and refactoring, and the slides contain a detailed example of how to carry through a major refactoring in many tiny steps
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
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.
In 2009 John Allspaw spoke at Velocity about how 10 deployments a day would become the norm. Since then the industry has evolved from config management and Cloud all the way to Data Center Operating Systems like Mesosphere and Kubernetes. How did we get here? And where are we headed? In this discussion we’ll look at recent advancements in technologies that are reshaping Development and Operations as we know it. We’ll also take a look at how the future of “DEV/ops” is not as much an evolution as it is a revolution, where the infrastructure teams of tomorrow provide microservices to engineering teams as part of an overall microservices ecosystem.
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
Lightening Talk I gave at Inaka in April 2014.
I was in charge of investigating test-driven development for our iOS mobile team. Since I realized it was such a big concept, after having gathered enough information and having played with it enough, I decided to introduce my fellows on the topic by presenting it in a formal talk with slides. The aim was teaching them a different way of developing, which, for us, at that moment, was completely new and controversial.
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
Getting Unstuck: Working with Legacy Code and DataCory Foy
From this presentation for the IASA in 2007, Cory covers common challenges in dealing with Legacy Code and Data, and some tools and techniques for handling them.
Unit testing and test-driven development are practices that makes it easy and efficient to create well-structured and well-working code. However, many software projects didn't create unit tests from the beginning.
In this presentation I will show a test automation strategy that works well for legacy code, and how to implement such a strategy on a project. The strategy focuses on characterization tests and refactoring, and the slides contain a detailed example of how to carry through a major refactoring in many tiny steps
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
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.
In 2009 John Allspaw spoke at Velocity about how 10 deployments a day would become the norm. Since then the industry has evolved from config management and Cloud all the way to Data Center Operating Systems like Mesosphere and Kubernetes. How did we get here? And where are we headed? In this discussion we’ll look at recent advancements in technologies that are reshaping Development and Operations as we know it. We’ll also take a look at how the future of “DEV/ops” is not as much an evolution as it is a revolution, where the infrastructure teams of tomorrow provide microservices to engineering teams as part of an overall microservices ecosystem.
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.
An introduction to Acceptance Test Driven Development (ATDD). We discuss the benefits and the best way to let test creation drive your development efforts, giving the teams the best chance to deliver what you need.
Quality management in continuous delivery and dev ops world pm footprints v1Dr. Anish Cheriyan (PhD)
Quality Management in Continuous Delivery and DevOps mode of development need to be looked from a different perspective. This talk will focus on how the project management and quality management practices need to be seen in different view when the software delivery is done in DevOps and SecOps Approach. In this presentation the presenter will cover following aspects:
• Traditional Quality management in Software Development Life Cycle
• An Overview to Continuous Delivery approach
• DevOps and SecOps
• Architecture and Infrastructure readiness ,
• Quality Assurance / Security Assurance and Test Quality Assurance in the pipeline
• Dev and Ops Collaboration
• Quantitative analysis of the Continuous Delivery System
• Periodic Assessment for System Refactoring Pattern
• Causal Analysis feedback (Defects, Problems Learning) to CD System
• Project Management approach and Conclusion
In this short presentation, I explore the relationship between Kaizen (lean) manufacturing and Agile Software Development to arrive at an easy to consume description of Dev/Ops
Recently I was asked to explain what dev-ops is at a large enterprise software vendor undergoing transformation.
In these slides, I present the concepts, tools and mindset that drive DevOPS.
Introductory DevOps talking of basic fundamentals, benefits, culture and mind set change, DevOps Scrum team, DevOps Patterns, tools and Spotify case study
Home Depot - From Platform Ops to Dev EnablementAnthony McCulley
The short story of how a small PaaS (Pivotal Cloud Foundry) operations team is providing value and service to our development community by treating them like customers and engaging them with the same values we approach our product development - delivering value and providing a good experience.
Test Driven Development (TDD) & Continuous Integration (CI)Fatkul Amri
Sebuah pembahasan menarik tentang Agile Software Development dengan Test Driven Development (TDD) & Continuous Integration (CI). Materi ini disusun oleh Mas Disyam
Last update to the DevOps anti-patterns talk that IMO deserves separate upload. It was about anti patterns captured consulting several projects on their DevOps adoption. There are few common pitfalls we can see repeating again and again over DevOps culture discovery. This talk is my experience summary there
We investigate one of the most popular approaches to creating software: test driven development. From the basic understanding why tests are important to a new software development paradigm, where you start with tests and them do the implementation. We glance over different areas of testing and see how one should really do the software testing in different situation.
One of the main hindrances to teams being able to respond rapidly to new features are technical problems resulting from bad coding practices, also known as technical debt. Melissa and Brett will cover Agile tools and practices that help development teams write better code and increase maintainability. Topics that will be covered include:
Pair programming
Automated Unit Testing
Refactoring
Test-Driven Development
Agile Architecture
Advanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.comDevOpsDays Tel Aviv
While A/B test is a very known and familiar methodology for conducting experiments on production when you do that on a large scale it has many challenges in the organization level and operational level.
At Wix we are practicing continuous delivery for over 4 years. Conducting A/B tests and writing feature toggles is at the core of our development process. However when doing so on a large scale, with over 1000 experiments every month, it holds many challenges and affect everyone in the company, from developers, product managers, QA, marketing and management.
In this talk we will explain what is the lifecycle of an experiment, some of the challenges we faced and the effect on our development process.
* How an experiment begins its life
* How an experiment is defined
* How do you let non technical people control the experiment while preventing mistakes
* How an experiment go live, what is the lifecycle of an experiment from beginning to end
* What is the difference between client and server experiments
* How do you keep the user experience and not confuse them
* How does it affect the development process
* How can QA test an environment that changes every 9 minutes
* How can support help users when every user may be part of different experiment
* How can we find if an experiment is causing errors when you have millions of permutations [at least 2^(number of active experiments)]
* What are the effects of always having multiple experiments on system architecture
* What are the development patterns when working with AB test
At Wix we have developed our 3rd generation experiment system called PETRI, which is (will be) open sourced, that helps us maintain some order in a chaotic system that keep changing. We will also explain how PETRI works, what are the patterns in conducting experiments that will have a minimal effect on performance and user experience.
Test and Behaviour Driven Development (TDD/BDD)Lars Thorup
In this introduction to Test Driven Development (TDD) or Behaviour Driven Development (BDD) we give a high level description of what it is and why it is useful for developers. Then we go into some details on stubs and mocks, test data, UI testing, SQL testing, JavaScript testing, web services testing and how to start doing TDD/BDD on an existing code base.
Test Driven Development, or TDD, is the mainstream in many areas of software development, but what about the database? In this session, we explore TDD, the benefits of automated testing, and how testing data projects differs from other types of development. We introduce the tSQLt testing framework and demonstrate its use with a live coding example. Finally, we will discuss some lessons learned in doing TDD with SQL Server.
Originally presented by Steve Fibich and David Moore at Richmond SQL Server Users Group on January 11, 2018
Improving The Quality of Existing SoftwareSteven Smith
Presented at DevReach 2013.
As developers, most of our time is spent working on existing software. Sure, occasionally we get the chance to fire up a new Solution in Visual Studio, and that can be exciting. But after the first day, we find ourselves once more having to deal with the work we did yesterday. And today, we know more than we did yesterday, so there are things we’d do differently, if we had it to do over.
Over time, software rots. If we’re not diligent, our beautiful code can degrade into a worthless mess. Keeping our code in working condition is no different than changing the oil in our car – it’s preventive maintenance. In this session, Steve will look at some common places to look for signs of degradation in existing applications, and steps to take to improve the code. Examples will use C# and primarily ASP.NET.
Unit tests give developers and testers a quick way to look for logic errors in the methods of classes in Visual C#, Visual Basic, and Visual C++ projects. A unit test can be created one time and run every time that source code is changed to make sure that no bugs are introduced.
Test-Driven development; why you should never code without itJad Salhani
This is a deep dive into the TDD world where you will discover how it helps scale the development
process. The talk tackles the business side as well as the technical side of the software development
to accommodate all audiences, i.e; Why you should invest in a testing "department" for example, or
why you should always take a look at your tests when writing code.
This is a deep dive into the TDD world where you will discover how it helps scale the development process. The talk tackles the business side as well as the technical side of the software development to accommodate all audiences, i.e; Why you should invest in a testing "department" for example, or why you should always take a look at your tests when writing code.
Database continuous integration, unit test and functional testHarry Zheng
Discuss continuous integration for database projects, including building project, deploying project to database, and executing unit tests and functional tests.
This presentation will also discuss database test standards, tips and tricks.
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!
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Hivelance Technology
Cryptocurrency trading bots are computer programs designed to automate buying, selling, and managing cryptocurrency transactions. These bots utilize advanced algorithms and machine learning techniques to analyze market data, identify trading opportunities, and execute trades on behalf of their users. By automating the decision-making process, crypto trading bots can react to market changes faster than human traders
Hivelance, a leading provider of cryptocurrency trading bot development services, stands out as the premier choice for crypto traders and developers. Hivelance boasts a team of seasoned cryptocurrency experts and software engineers who deeply understand the crypto market and the latest trends in automated trading, Hivelance leverages the latest technologies and tools in the industry, including advanced AI and machine learning algorithms, to create highly efficient and adaptable crypto trading bots
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
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.
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
Your Digital Assistant.
Making complex approach simple. Straightforward process saves time. No more waiting to connect with people that matter to you. Safety first is not a cliché - Securely protect information in cloud storage to prevent any third party from accessing data.
Would you rather make your visitors feel burdened by making them wait? Or choose VizMan for a stress-free experience? VizMan is an automated visitor management system that works for any industries not limited to factories, societies, government institutes, and warehouses. A new age contactless way of logging information of visitors, employees, packages, and vehicles. VizMan is a digital logbook so it deters unnecessary use of paper or space since there is no requirement of bundles of registers that is left to collect dust in a corner of a room. Visitor’s essential details, helps in scheduling meetings for visitors and employees, and assists in supervising the attendance of the employees. With VizMan, visitors don’t need to wait for hours in long queues. VizMan handles visitors with the value they deserve because we know time is important to you.
Feasible Features
One Subscription, Four Modules – Admin, Employee, Receptionist, and Gatekeeper ensures confidentiality and prevents data from being manipulated
User Friendly – can be easily used on Android, iOS, and Web Interface
Multiple Accessibility – Log in through any device from any place at any time
One app for all industries – a Visitor Management System that works for any organisation.
Stress-free Sign-up
Visitor is registered and checked-in by the Receptionist
Host gets a notification, where they opt to Approve the meeting
Host notifies the Receptionist of the end of the meeting
Visitor is checked-out by the Receptionist
Host enters notes and remarks of the meeting
Customizable Components
Scheduling Meetings – Host can invite visitors for meetings and also approve, reject and reschedule meetings
Single/Bulk invites – Invitations can be sent individually to a visitor or collectively to many visitors
VIP Visitors – Additional security of data for VIP visitors to avoid misuse of information
Courier Management – Keeps a check on deliveries like commodities being delivered in and out of establishments
Alerts & Notifications – Get notified on SMS, email, and application
Parking Management – Manage availability of parking space
Individual log-in – Every user has their own log-in id
Visitor/Meeting Analytics – Evaluate notes and remarks of the meeting stored in the system
Visitor Management System is a secure and user friendly database manager that records, filters, tracks the visitors to your organization.
"Secure Your Premises with VizMan (VMS) – Get It Now"
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
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
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
7. What’s not a unit test?
I like Michael Feathers’ explanation from Working Effectively with Legacy Code.
It’s not a unit test if:
• It talks to a database
• It communicates across a network
• It touches the file system
• You have to do special things to your environment to run it (like editing a
config file)
8. DIFFICULT
SCENARIOS TO
UNIT TEST
Closed Object Models
(Sharepoint, Silverlight)
Client – server architecture
- Communicating Across a Network
An out-of-process call
- Includes talking to databases and
Web Services
UI/GUI interaction
Touching the File System
Legacy Code
Requires the Environment to be
configured
11. “When you first start at doing TDD you know what the design should be. You
know what code you want to write. So you write a test that will let you write that
bit of code.
“When you do this you aren't really doing TDD – since you are writing the code
first (even if the code is only in your head )
“It takes some time to realize that you need to focus on the test. Write the test
for the behavior you want - then write the minimal code needed to make it pass
- then let the design emerge through refactoring. Repeat until done.”
--Brian Rasmussen
http://www.slideshare.net/baronslideshare/testdriven-development-tdd
12. An Exercise in
Test Driven
Development
The idea here is going to be to go
through the exercise of designing a
portion of a new solution in real
time.
After the exercise I want to circle
back and point out the benefits we
gained from the test first approach
which may have been missed had
we coded and then wrote tests.
13. Principles
• Think About What You Are Trying To Do
• Follow The TDD Cycle
• Never Write New Functionality Without A
Failing Test
- Each test should be for a single
concept
• Continually Make Small, Incremental
Changes
• Keep The System Running At All Times
- No one can make a change that breaks the
system
- Failures Must Be Address Immediately
• Is an activity of the developer
• Test code should be treated the same as
“production”
- maintained
- refactor
- source control
• Experimentation
- Names don’t matter initially
• When you want to change existing code,
first write covering, white box, unit tests
and then use TDD to add new
functionality
• Fix it in the simplest way possible using
as many assumptions as you like
15. Realizing quality improvement through test driven development
Metric Description IBM:
Drivers
MSFT:
Windows
MSFT:
MSN
MSFT:
VS
Defect density of
non-TDD team
W X Y Z
Defect density of
team using TDD
0.61W 0.38X 0.24Y 0.09Z
% increase in
coding time
because
of TDD
[Management
estimates]
15-20% 25-35% 15% 25-30%
http://research.microsoft.com/en-us/groups/ese/nagappan_tdd.pdf
18. What’s a mock object?
A Test Double object that is pre-programmed with expectations which form a
specification of the calls they are expected to receive
The nice thing about using mocks while doing TDD is we can mock something
that doesn’t actually exist. Just define an interface and mock that. Later on we
can create concrete implementations of the interface (through TDD, of course)
19. Chicago vs London
Ledger
● Calculate(string expression)
Calculator
● Add
● Subtract
● Multiply
● ...
Based on http://programmers.stackexchange.com/a/123672
ledger.Calculate("5 * 7")
20. [TestFixture]
public class LedgerTests
{
public static Ledger Ledger { set; get; }
public static int Value { get; set; }
public static Mock<ICalculator> calculator;
[SetUp]
public void LedgerSetup()
{
calculator = new Mock<ICalculator>();
Ledger = new Ledger(calculator.Object);
}
21. Chicago vs London
[Test]
public void ChicagoStyle()
{
Value = Ledger.Calculate("5 * 7");
Assert.AreEqual(35, Value);
}
The Chicago/State school would have you assert whether the result is 35. The jUnit/nUnit frameworks are generally geared
towards doing this.
22. Chicago vs London
[Test]
public void ChicagoStyle()
{
Value = Ledger.Calculate("5 * 7");
Assert.AreEqual(35, Value);
}
The Chicago/State school would have you assert whether the result is 35. The jUnit/nUnit frameworks are generally geared
towards doing this.
[Test]
public void LondonStyle()
{
calculator.Verify(calc => calc.Multiply(5, 7), Times.Exactly(1));
}
The London/Interaction school would have you assert whether Calculator.Multiply(5,7) got called. The various
mocking frameworks are useful for this, and it can be very useful if, for example, you don't have ownership of the "Calculator"
object (suppose it is an external component or service that you cannot test directly, but you do know you have to call in a
particular way).
24. Other resources mentioned by attendees
The following resources were mentioned after the presentation. They require
purchase or subscription.
• Play by Play: TDD with Brad Wilson (Pluralsight)
• https://www.pluralsight.com/courses/play-by-play-wilson-tdd
• Automated Testing for Fraidy Cats Like Me with Julie Lerman (Pluralsight)
• https://www.pluralsight.com/courses/automated-testing-fraidy-cats
• Test-Driven Development training by Mike Hill & Joshua Kerievsky (Industrial
Logic)
• https://elearning.industriallogic.com/gh/submit?Action=AlbumContentsAction&album=before
&devLanguage=Java
Editor's Notes
I’m coming at this as a fellow traveller - not an expert
Understand the differences between automated testing and test driven development
Understand where the value of test driven development lies
Introduction to the Moq framework
Error localization: “As tests get further from what they test, it’s harder to determine what a test failure means.” Michael Feathers Working Effectively with Legacy Code
Execution time: Large tests take longer to run. Longer to run means not run as frequently (if at all)
Tighter feedback loop: related to execution time - don’t have to wait as long to know if you’re code changes broke anything
Coverage: It’s easier to test the different execution paths in a unit test. Think about testing a new feature in a large, existing end-to-end test versus adding a unit test to exercise it
“Maintenance fixes and “small” code changes may be nearly 40 times more error prone than new development (Managing the Software Process, Watts S. Humphrey, Addison-Wesley, 1989)... By continuously running automated test cases, one can find out whether a change breaks the existing system early on, rather than leading to a late discovery.” - Realizing quality improvement through test driven development: results and experiences of four industrial teams, Nachiappan Nagappan & E. Michael Maximilien & Thirumalesh Bhat & Laurie Williams, Springer Science + Business Media, LLC, 2008
Tests like these aren’t bad. There may be value in writing them. They just aren’t unit tests.
Feathers’ definition of a unit test is driven by two properties:
Does the test run fast?
A unit test that takes 1/10th of a second is too long. 3,000 classes w/ 10 tests each at that speed is about an hour of test time
Does it help localize errors quickly?
Notice entry point is a new requirement not a new feature
This is a tight loop - short iterations are important
We’re only producing code needed for the current test
The goal is to produce working clean code that fulfills the requirement
Though poorly worded, the thrust of this quote is helpful.
Add a comment for tests we want to circle back to that aren’t happy path (like in video where passing in coordinates that don’t correspond to a valid board position)
Don’t do calculations in your tests b/c it often means you’re recreating a code calculation - you could just be recreating a bug but the test will pass
Reminder - NUnit 2.6.4 - My version of R# won’t work with NUnit 3.x
It’s mostly about design
Confidence in changes
Is documentation by example
Immediate feedback
Gerard Meszaros uses the term Test Double as the generic term for any kind of pretend object used in place of a real object for testing purposes. The name comes from the notion of a Stunt Double in movies. He then defined four particular kinds of double:
Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an in memory database is a good example).
Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test. Stubs may also record information about calls, such as an email gateway stub that remembers the messages it 'sent', or maybe only how many messages it 'sent'.
Mocks are what we are talking about here: objects pre-programmed with expectations which form a specification of the calls they are expected to receive.
Only mocks insist upon behavior verification.
Suppose you have class called "ledger" a method called "calculate" that uses a "Calculator" to do different types of calculations depending on the arguments passed to "calculate", for example "multiply(x, y)" or "subtract(x, y)".
Now, suppose you want to test what happens when you call ledger.calculate("5 * 7")
The Chicago/State school would have you assert whether the result is 35. The jUnit/nUnit frameworks are generally geared towards doing this.
The London/Interaction school would have you assert whether Calculator.multiply(5,7) got called. The various mocking frameworks are useful for this, and it can be very useful if, for example, you don't have ownership of the "Calculator" object (suppose it is an external component or service that you cannot test directly, but you do know you have to call in a particular way).
This is the base test class. Don’t worry about the syntax of the mock… just understand what it is.
The Chicago/State school would have you assert whether the result is 35. The jUnit/nUnit frameworks are generally geared towards doing this.
The Chicago/State school would have you assert whether the result is 35. The jUnit/nUnit frameworks are generally geared towards doing this.