Practice TDD with Cyber-Dojo

Agile Alliance

In this lightning talk, Seb Rose introduces Cyber-Dojo, a free, open source, online training environment for people who want to get better at TDD. Technology tdd

TDD 102

TDD and Legacy Code

Net Objectives

TDD is a powerful way to develop new code. In his excellent book, Working Effectively with Legacy Code, Michael Feathers outlines techniques … Continue reading "TDD and Legacy Code". Audio Available TDDHowever, most organizations have significant existing code that was not developed this way. This “legacy code” is often difficult to test because it was not designed to be testable in the first place.

TDD 40

TDD and System Architecture

Net Objectives

When first adopting TDD, developers can run into some roadblocks that seem to indicate that TDD is a difficult process. For example, developers will struggle to write unit tests of behavior that is embedded in a user interface, or in stored procedures … Continue reading "TDD and System Architecture". Audio Available TDDIn truth, some of these problems actually indicate faults in the system architecture.

Sustainable TDD: Part 3

Net Objectives

TDD depends on a strong connection between the automation of the test suite and the system itself. So, if errors creep into the test … Continue reading "Sustainable TDD: Part 3". Audio Available TDDThe suite should record the specification that is implemented in the system, and the connection allows this to be confirmed at any point. The problem is automated tests pass by default.

TDD 40

Team Leadership in the Age of Agile

Speaker: Roy Osherove, Technology and Leadership Consultant

To do this, you've learned a wide variety of techniques and methodologies - SCRUM, Kanban, TDD, DevOps, self-organized teams, and much more.

Sustainable TDD: Part 1

Net Objectives

TDD is typically part of an agile process. In TDD, a new requirement always starts out as a new, failing test or “specification.” We write the test … Continue reading "Sustainable TDD: Part 1". Audio Available TDDThis means that we embrace change, that new requirements flow into the team’s work either on a time-boxed pulse, or through some kind of pull system (like Kanban).

TDD 40

TDD and Test Invariance

Net Objectives

TDD often uses unit tests to drive behavior into the system. When these are automated, this can give us clues as to how to make our work in TDD more reusable. Tools like Fit, Specflow, and Cucumber are all designed to parse some non-technical artifact (such … Continue reading "TDD and Test Invariance". Audio Available TDDHowever, sometimes acceptance tests are used to do this.

TDD 40

TDD: Keeping Tests Green

Net Objectives

Ideally in TDD, no more than one test is ever failing at any given point in time. We want the suite to get back to “all green” as quickly … Continue reading "TDD: Keeping Tests Green". Audio Available TDDThis test represents the work that is about to be done but hasn’t yet. Also, this test should not spend a long time in the red.

TDD 40

TDD and Reported Defects

Net Objectives

TDD views this very differently. In TDD, a “defect” is code that … Continue reading "TDD and Reported Defects". Audio Available TDDMost organizations have some type of reporting mechanism allowing customers to alert them to defects they have encountered. Typically, a “trouble ticket” or similar artifact is generated, and someone is assigned the task to 1) locate and then 2) fix the errant code.

TDD 40

TDD and Guard Assertions

Net Objectives

In TDD, tests take actions such as Setup, Trigger, and Verify. For example, If … Continue reading "TDD and Guard Assertions". Audio Available TDDEach of these pieces must successfully execute in order for the specification to be verified as accurate to the current behavior of the system. If there is an external dependency, the test can become vulnerable to a failure of that entity.

TDD 40

TDD and Test Anatomy

Net Objectives

TDD, when conducted as a specifying activity, is an aspect of Behavior-Driven Development (BDD). Therefore, when structuring the tests in TDD we can be guided by the language of BDD: Given, When, Then. Given the system is in a known … Continue reading "TDD and Test Anatomy". Audio Available TDDBehavior is what we specify and is what we “drive” into the system using tests.

TDD 40

TDD Replicating Algorithms

Net Objectives

This feels like redundancy and makes them wonder if TDD is promoting bad practices. The code would contain something like this: return (F - 32) * 5/9; The test might contain … Continue reading "TDD Replicating Algorithms". Audio Available TDDDevelopers often remark that the tests may contain the same algorithms that the production code does. Example: A system that converts Fahrenheit to Celsius.

TDD 40

TDD Yields Velocity

Net Objectives

When TDD was first suggested, there were many who were dubious about the wisdom of having developers write tests of their own code. Give someone more … Continue reading "TDD Yields Velocity". Audio Available TDDAmong the objections raised was that developers will slow down if you burden them with new tasks, namely writing the tests as well as the code. This seems logical.

TDD 40

TDD Yields Confidence

Net Objectives

TDD is a process that provides constant confirmation to the development team. The … Continue reading "TDD Yields Confidence". Audio Available TDDWriting the tests up-front confirms that there is sufficient understanding of requirements so that they can be expressed in the rigorous form of a unit test. Alternately, it reveals that this understanding has gaps and reveals questions that need to be answered.

TDD 40

What Is TDD?

Net Objectives

I am heartened by the surge in TDD training. To me TDD is the 2nd most important thing for devs to learn-ATDD being the 1st TDD’s not just the automation of unit testing. TDD’s formulation of tests, prior to code, drives design. High quality code is easy … Continue reading "What Is TDD?". Emergent Design TDD Technical Agility

TDD 40

Announcing the TDD Companion

Net Objectives

I have just posted the sixtieth entry in this series and this seemed like enough content to gather into a sort … Continue reading "Announcing the TDD Companion". Audio Available TDDFor the last few month, I have been posting several times a week on what I hope are interesting topics relating to aspects of Test-Driven Development. Many people have commented positively on this work.

TDD 40

TDD and Inflection Points

Net Objectives

As our industry matures it becomes increasingly true that we don’t need to re-invent the wheel For example, if code is written that is required to send data over a TCP-IP connection in, say, C#, the tendency is for … Continue reading "TDD and Inflection Points". Audio Available TDDSoftware is quite often implemented in the context of reusable frameworks and other preexisting, valuable entities.

TDD 40

TDD and Encapsulation

Net Objectives

The type and nature of the tests that you write in TDD helps you to understand how strongly your system is encapsulated. The more your tests are about … Continue reading "TDD and Encapsulation". Everything the system must do, and yet might not, needs a test. Here, “must do” comes from your stakeholders’ requirements, and is therefore connected to business value.

TDD 40

Specifying Constants in TDD

Net Objectives

TDD is different from QA in many respects. The government will dictate how quickly a … Continue reading "Specifying Constants in TDD". Audio Available TDDPart of this involves the tests we choose to write. A case in point is the specification of public constants. Example. When businesses buy assets, they can write-off (amortize) the value of those assets over time, as a taxation issue.

TDD 40

TDD and Design Patterns

Net Objectives

Similarly, TDD was first promoted around the same time in history as part of eXtreme Programming. Some have suggested that these two points of view stand in opposition to each other, saying Design patterns are about up-front design, while … Continue reading "TDD and Design Patterns". Audio Available Design Patterns TDDDesign patterns in software came from the work of the Gang of Four in the mid-1990’s.

TDD 40

Specifying Exceptions in TDD

Net Objectives

When an exception is declared in … Continue reading "Specifying Exceptions in TDD". Audio Available TDDExceptions in software represent a mechanism for raising an alarm when something goes wrong. They are used when there is a potential problem that cannot be detected by the compiler, linker, or other automated aspect of the development process, and thus may potentially make it into the released product.

TDD 40

Refactoring Applied to TDD

Net Objectives

Since TDD focuses on driving new behavior from tests, how would refactoring play … Continue reading "Refactoring Applied to TDD". Audio Available Refactoring TDD“Refactoring” refers to the discipline of improving the design of existing code without changing its behavior. It is usually thought of as a way to deal with old legacy code that is functional but poorly designed and thus hard to work with.

TDD 40

TDD and Code Coverage Tools

Net Objectives

In TDD and Code Coverage, we established that code coverage tools do not provide useful project metrics, in and of themselves. In TDD, we don’t use code coverage tools for this purpose because we don’t need to. Continue reading "TDD and Code Coverage Tools". Audio Available TDDIf all production code is written to satisfy prewritten, failing tests, then by definition, all code is covered.

TDD 40

Commonly Missing Tests in TDD

Net Objectives

Because TDD is “test” driven development, people tend to think of TDD as “writing tests first.” In fact, TDD is not a testing activity per se. Because of this … Continue reading "Commonly Missing Tests in TDD". Audio Available TDDIt is the creation of an executable specification prior to the creation of each system element. Unit tests are a very useful by-product of this process.

TDD 40

Specifying the Negative in TDD

Net Objectives

The implication would be that the object has … Continue reading "Specifying the Negative in TDD". Most requirements are statements of desired behavior. But there can be implications behind these requirements concerning behavior that is not desired. For example, we might test-drive a value object that represents some domain information, and the requirement for it might include that the object must be “immutable.”

TDD 40

TDD: primitive obsession ( part 3 )

Apiumhub

Last month we talked about TDD example in software development ( part 1 ) and TDD first cycle ( part 2 ). In this new TDD and primitive obsession article, we will focus on removing duplication and reinforcing the constructors of our entities, something key to have a robust system. TDD: primitive obsession. We enter the phase of Refactor, in this phase we not only remove duplication, we also design our application within this space that TDD provides us.

TDD 71

“Good” Tests in TDD

Net Objectives

Often the developers understand and agree that these qualities are important, but they are not … Continue reading "“Good” Tests in TDD". Audio Available Design Patterns Emergent Design TDDAs consultants, we are often asked to review the work of others. One of the things we review is the quality of the design of some part of the system. Is it cohesive, decoupled, non-redundant, encapsulated, open-closed, and so forth?

TDD 40

TDD and the OCP

Net Objectives

This means that a “good” design will allow for a new behavior to be added to a system without having to change the existing code, or at least to minimize … Continue reading "TDD and the OCP". Audio Available TDDThe Open-Closed Principle (Bertrand Myers, Ivar Jacobsen) states, “Software entities (such as classes, modules, and functions) should be open for extension, but closed for modification.”

TDD 40

TDD and the Magic Buttons

Net Objectives

If you push Button B, you will have 80% code … Continue reading "TDD and the Magic Buttons". Audio Available TDDHere is a bit of a thought experiment, first suggested to me by Eran Pe’er. Imagine there are two magic buttons in front of you. You know, without any doubt that if you press Button A then your code will suddenly have 90% code coverage.

TDD 40

TDD First Cycle ( part 2)

Apiumhub

Let’s continue with our series of TDD articles, in the first part we looked at the theory behind the TDD and Unit Testing. In this second part, TDD First Cycle , we begin to develop our application, an application of notes where a user can write notes and everything that comes to our mind. TDD First Cycle. We always have to have in mind the TDD cycle. Okay, we already have a test in red as TDD First Cycle indicates: RED.

TDD 63

TDD and Code Coverage

Net Objectives

Measurement tools are used as a process gate, where the team must achieve this minimum coverage level before code can be checked … Continue reading "TDD and Code Coverage". Audio Available TDDIt’s not unusual these days for development organizations to adopt a code coverage requirement. This is usually expressed as a percentage: at least X% of all code developed must be covered by tests.

TDD 40

TDD and Accuracy vs. Precision

Net Objectives

The level of precision required … Continue reading "TDD and Accuracy vs. Precision". Audio Available TDDIt is important that the system behaviors we create as developers are both accurate and precise. These are not the same. One can be: Accurate, but not precise: “Pi is a little over three.” Precise, but not accurate: “Pi is 5.393858303895.” They are not the same but they are related.

TDD 40

TDD and Naming: Part 1

Net Objectives

TDD is not really a testing activity so much as it is about the creation of an executable specification. Many IDE’s will … Continue reading "TDD and Naming: Part 1". Audio Available TDDBecause of this we value different things than testers might. Naming of tests, variables, and the use of well-named customized assertions are examples. Test names are sometimes provided by the tools we use.

TDD 40

TDD: Testing Adapters for Abstract Classes

Net Objectives

But if all behavior in TDD needs to be tested, and if instance behavior implemented in abstract classes cannot be tested … Continue reading "TDD: Testing Adapters for Abstract Classes". Abstract classes in languages like Java or C# serve two purposes: they create polymorphism in design, and they are a convenient place to put behavior that is common to all derived classes, avoiding redundancy.

TDD 40

TDD and Naming: Part 2

Net Objectives

For example, if we had a system behavior that converted a temperature expressed in Fahrenheit to one expressed in Celsius, then the test that specified this might have an assertion along these lines: assertEquals(100, … Continue reading "TDD and Naming: Part 2". Audio Available TDDTests often establish example values used to compare the behavior of the system with the actual behavior indicated in the requirements.

TDD 40

TDD as a Sustainable Process: Introduction

Net Objectives

This is my 48th post in this series on TDD. I wanted to bring some of this material together and engage with the notion of TDD as a sustainable process. There are those … Continue reading "TDD as a Sustainable Process: Introduction". In this posting, I will introduce the topic, and then cover some issues that pertain to sustainability and/or the seeming lack thereof.

TDD 40

TDD: Tests are Client Number 1

Net Objectives

Part of the TDD process consists of writing failing tests before the code that will eventually make them pass. Test-first alone is not TDD per se, but it is a part of it. This comes from the fact that these tests have the … Continue reading "TDD: Tests are Client Number 1". Audio Available TDDWhen tests are written before production code, this has several beneficial effects.

TDD 40