DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Diagnosing Test Failures at Scale: Correlating Execution Evidence Across Ephemeral Runners
  • AI-Powered CI Test Failure Triage
  • When a Coding Agent Fixes the Test Instead of the Bug
  • Testing Java and Spring Applications With Kotlin: Low-Risk to Adoption

Trending

  • Full-Text Search Meets the Graph: Apache Lucene Inside Neo4j
  • Why Successful Tech Transformation Starts With Clarity
  • When Production Stops Moving: Running Claude Code Across a Distributed Enterprise Integration Team
  • The Self-Hosting Math Changed While We Were Still Arguing About Sovereignty

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Testing, Tools, and Frameworks
  4. Canary Tests

Canary Tests

By 
Cyrille Martraire
·
Feb. 07, 14 · Interview
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
40.8K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

canary tests are minimal tests to quickly and automatically verify that the everything you depend on is ready. you run canary tests before other time-consuming tests, and before wasting time investigating in your code when the other tests are red. if the canary test fails, you know you have to fix something on the environments first.

this idea of canary test is different from the canary deployment. in canary deployment you deploy to a small fraction of your users to check everything’s fine before rolling out to more users.

save time by checking what should be always ok

canary tests check for the obvious and frequent sources of issues, such as:

  • connectivity to network : firewall rules ok, ports open, proxy working fine, nat, ping below a good threshold

  • databases and middleware are up
  • disk quota for logs not almost full
  • every needed login and password is valid
  • installed software available in the right version: dll installed, registry set-up, environment variables set, user directories all exist, the frameworks and os versions are fit, timezone and locale are as expected
  • reference data integrity and consistency (dates, valuations…) are ok
  • database schema and audit of applied scripts are as expected
  • licences are not expired (there is usually a way to check that automatically)

canary tests should run regularly, ideally before any expensive tests like end-to-end tests. of course you want to run them whenever there is a trouble somewhere, before wasting time on manual investigations in your code when the expected environment is not fully available.

even at the code level, a canary test is just a trivial test to verify that the testing framework works correctly, as mentioned by marcus on his blog :

	asserttrue(true)

don’t forget to verify that your tests can fail too!

simple and low-maintenance

the canary test tools should not assume much from the application. they must be independent from new developments to be as stable as possible. they should require little to no maintenance at all.

one way to do that in practice is to simply scan configuration files for every url, password and just ping them one by one against a predefined time threshold. any log path mentioned in the configuration files can be scanned and checked for the required write permissions and available disk space. any login and password can be checked, even though this may be more complicated.

canary tests are documentation too

doing canary tests may require explicit declarations of expectations, e.g. an annotation assumedpermission(’777′) to declare the permissions required on the files referenced in the configuration files. alternatively you may rely on a convention over configuration principle. for example every

 log.*.path

variable is assumed  to be a log path to check against some predefined expectations like being writable and being ok with disk quota.

when you add canary tests, this automation itself is a form of documentation that makes assumption more explicit.

you could export a report of every canary test that has been ran into a readable form that can become part of your living documentation .

Testing

Published at DZone with permission of Cyrille Martraire. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Diagnosing Test Failures at Scale: Correlating Execution Evidence Across Ephemeral Runners
  • AI-Powered CI Test Failure Triage
  • When a Coding Agent Fixes the Test Instead of the Bug
  • Testing Java and Spring Applications With Kotlin: Low-Risk to Adoption

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook