The Way of TDD


This article was adapted from a Google Tech on the Toilet (TotT) episode. You can download a printer-friendly version of this TotT episode and post it in your office.

By Bartosz Papis

Test-Driven Development (TDD) is the practice of working in a structured cycle where writing tests comes before writing production code. The process involves three steps, sometimes called the red-green-refactor cycle:

  1. Write a failing test 
  2. Make the test pass by writing just enough production code 
  3. Refactor the production code to meet your quality standards
The three steps in TDD

Research shows TDD has several benefits: it improves test coverage, reduces the number of bugs, increases confidence, and facilitates code reuse. This practice also helps reduce distractions and keep you in the flow. TDD also has its limitations and is not a silver bullet! See the Wikipedia article about TDD for a detailed explanation and references.

Here is a short practical example. Assume you need to modify the following voting algorithm to support the option for voters to abstain:

def outcome(ballots):

  if ballots.count(Vote.FOR) > len(ballots) / 2:

    return "Approved"

  return "Rejected"

1. We start by writing a failing test - as expected, the test doesn't even compile:

def test_abstain_doesnt_count(self):

  self.assertEqual(outcome([Vote.FOR, Vote.FOR, Vote.AGAINST, Vote.ABSTAIN]), "Approved")

2. We fix the compilation error by including the missing enum option:

class Vote(Enum):

  FOR = 1

  AGAINST = 2

  ABSTAIN = 3

Now that the test compiles, we fix the production code to get all tests passing:

def outcome(ballots):

  if ballots.count(Vote.FOR) > (len(ballots) - ballots.count(Vote.ABSTAIN)) / 2:

    return "Approved"

  return "Rejected"

3. We now refactor the code to improve clarity, and complete an iteration of the TDD cycle:

def outcome(ballots):

  counts = collections.Counter(ballots)

  return "Approved" if counts[Vote.FOR] > counts[Vote.AGAINST] else "Rejected"


Learn more about TDD in the book
Test Driven Development: By Example, by Kent Beck.

Introducing Wednesday Build Hour

Wednesday Build Hour is a weekly, interactive "technical gym session" led by Google Cloud experts to help developers and architects sharpen their cloud skills. Moving beyond passive slide decks, the program focuses on hands-on building, covering advanced topics like AI agents, Vertex AI, and developer productivity tools. Each hour-long session is designed to provide tangible results that participants can immediately deploy into their own workflows. It serves as a consistent, dedicated space for builders to stay ahead of the curve and connect with a community of cloud engineers.

Assign Google Calendars to Google Meet hardware in bulk

We’re making it easier to manage calendar assignments for your Meet hardware devices. You can now assign or unassign Google Calendars to your Meet hardware devices in bulk by uploading a CSV file. For organizations with a large number of devices, this eliminates the need to assign calendars one by one, saving you significant time and administrative effort.

The new “assignedCalendarResourceEmail” column in the bulk update CSV file.

Bulk update device dialogue mentioning the new bulk update calendar assign capability

When preparing your CSV file, please keep the following in mind:

  • To unassign a calendar from a device, simply leave the assignedCalendarResourceEmail cell for that device’s row empty.
  • While a personal calendar can be assigned to multiple devices, a room calendar resource can only be assigned to one device at a time. To move a calendar resource to a new device using CSV, you must first perform a CSV upload to unassign it, and then a second CSV upload to assign it to the new device.

Getting started

  • Admins: To use this feature, you’ll need the “Manage calendar assignment” privilege. Without this privilege, any calendar updates in your upload will fail, though other changes (like settings and organizational unit updates) may still be applied. Visit the Help Center to learn more about assigning a Google Calendar to Meet hardware and bulk updating Meet hardware settings.
  • End users: There is no end user impact or action required.

Rollout pace

Availability

  • Available for all Google Workspace customers

Resources

Assign Google Calendars to Google Meet hardware in bulk

We’re making it easier to manage calendar assignments for your Meet hardware devices. You can now assign or unassign Google Calendars to your Meet hardware devices in bulk by uploading a CSV file. For organizations with a large number of devices, this eliminates the need to assign calendars one by one, saving you significant time and administrative effort.

The new “assignedCalendarResourceEmail” column in the bulk update CSV file.

Bulk update device dialogue mentioning the new bulk update calendar assign capability

When preparing your CSV file, please keep the following in mind:

  • To unassign a calendar from a device, simply leave the assignedCalendarResourceEmail cell for that device’s row empty.
  • While a personal calendar can be assigned to multiple devices, a room calendar resource can only be assigned to one device at a time. To move a calendar resource to a new device using CSV, you must first perform a CSV upload to unassign it, and then a second CSV upload to assign it to the new device.

Getting started

  • Admins: To use this feature, you’ll need the “Manage calendar assignment” privilege. Without this privilege, any calendar updates in your upload will fail, though other changes (like settings and organizational unit updates) may still be applied. Visit the Help Center to learn more about assigning a Google Calendar to Meet hardware and bulk updating Meet hardware settings.
  • End users: There is no end user impact or action required.

Rollout pace

Availability

  • Available for all Google Workspace customers

Resources

New Device ID for Google Meet hardware

We’re replacing the current Device ID (“Legacy ID”) for Google Meet hardware devices with a new Device ID. This new Device ID will be displayed everywhere you currently see the Legacy ID throughout the Google Admin console:

  • The device list, details, history, and videocalling pages (Admin console > Devices > Google Meet hardware)
  • All device-keyed URLs in the Admin console
  • Audit logs and BigQuery exports
  • Bulk upload and download features
  • Device ID filter in Meet quality tool (Admin console > Apps > Google Workspace > Settings for Google Meet > Meet quality tool)

Additional details
  • Bulk Updates: Bulk updating device settings by uploading a file on the device list page will require the new Device ID.
  • Audit Logs: Audit logs (Admin console > Reporting > Audit and investigation) and their BigQuery exports will use the new Device ID for all entries going forward. Existing audit logs created before this change will not be modified.
  • Transitioning to the new ID:
    • During the rollout, you may see different IDs for the same device in different locations
    • For the next 6 months after the rollout, you can use either ID in URLs, bulk uploads, the device list page, and the Meet Quality Tool. The Legacy ID will no longer be supported 6 months after the rollout is complete.

Getting started

Rollout pace

Availability

  • Available to all Google Workspace customers with Google Meet hardware devices

Resources

New Device ID for Google Meet hardware

We’re replacing the current Device ID (“Legacy ID”) for Google Meet hardware devices with a new Device ID. This new Device ID will be displayed everywhere you currently see the Legacy ID throughout the Google Admin console:

  • The device list, details, history, and videocalling pages (Admin console > Devices > Google Meet hardware)
  • All device-keyed URLs in the Admin console
  • Audit logs and BigQuery exports
  • Bulk upload and download features
  • Device ID filter in Meet quality tool (Admin console > Apps > Google Workspace > Settings for Google Meet > Meet quality tool)

Additional details
  • Bulk Updates: Bulk updating device settings by uploading a file on the device list page will require the new Device ID.
  • Audit Logs: Audit logs (Admin console > Reporting > Audit and investigation) and their BigQuery exports will use the new Device ID for all entries going forward. Existing audit logs created before this change will not be modified.
  • Transitioning to the new ID:
    • During the rollout, you may see different IDs for the same device in different locations
    • For the next 6 months after the rollout, you can use either ID in URLs, bulk uploads, the device list page, and the Meet Quality Tool. The Legacy ID will no longer be supported 6 months after the rollout is complete.

Getting started

Rollout pace

Availability

  • Available to all Google Workspace customers with Google Meet hardware devices

Resources

Updates to meetings made by a delegate user are now sent in the name of the principal

In many organizations, executives and senior leaders rely on admins or delegates to oversee their busy schedules. In Google Calendar this can be set up by sharing an executive’s calendar with “Make changes to events” or “Make changes and manage sharing” permissions with a delegate user.

We’re updating how meeting notifications are handled when someone manages a calendar on behalf of another user: Previously, initial invitations created by the delegate appeared to come from the principal, but subsequent updates or cancellations were sent from the delegate’s email.

To provide a more consistent experience for meeting participants, all event-related emails — including cancellations and modifications — will now come from the principal. This change ensures seamless calendar management and prevents confusion for guests who may be unfamiliar with the delegate acting on the principal's behalf.

Getting started

  • Admins: There is no admin control for this feature. Visit the Help Center to learn more.
  • End users: There is no end user setting for this feature. Visit the Help Center to learn more.

Rollout pace

Availability

  • Available to all Google Workspace customers, Workspace Individual subscribers, and users with personal Google accounts

Resources