test in production
This article is a stub. You can help the IndieWeb wiki by expanding it.
test in production is (AKA testing in production) deploying code changes to a web site or service typically visible to the public as part of checking to see if the code changes function as expected, and is practiced by some IndieWeb creators especially with their own projects as a form of eating their own cooking, often before publishing code changes to an open source repository.
Why
Testing your code in production on your own site is one way to use what you make before sharing it with others to make sure it behaves as expected, and personally take the risk & responsibility for those changes rather than offloading those burdens to whoever might be using your open source project.
Precautions
While testing your code in production can be a good part of using what you make, security precautions should still be taken. Showing errors, warnings and notices usually reserved for dev environments can be a big security risk due to the fact that things like paths, usernames, secret keys, etc. might be inadvertently shown to anyone who cares to look.
How to
How to log errors
Itβs not great UX to have confusing error messages intermingled with content.
Rather, you should log all such messages somewhere where only you can see them, or only show them in-page if youβre logged in as an admin.
In PHP, there are several ways to go about this.
- Setting
display_errors off
in your php.ini - Within PHP:
ini_set('display_errors', 'off');
- For a single line:
@codeWhichIsCausingErrors();
- If youβre logged in as an admin:
if ($user->isAdmin()) ini_set('display_errors', 'on');
IndieWeb Examples
Tantek
Tantek Γelik has been testing CASSIS in production on his personal site tantek.com since creating it and continues to do so, in the hopes that any errors in code changes will be revealed on his personal site before they affect others.
Manton
Corporate Examples
When corporations (e.g. silos) test in production, the results are often documented in unflattering ways unfortunately.
While "testing in production" may exercise some aspects, it is not a replacement for formal testing & QA methods.
@benward: Great moments in code review
(at an unknown corporation)
Other Examples
Solarwind
See Also
- use what you make
- eat what you cook
- Physical example: https://twitter.com/pgrizzaffi/status/1581729924951351297
- "Uhhh... Pretty sure those are red plums. I know these things now that I am a farmer.
#TestingInProduction" @pgrizzaffi October 16, 2022
- "Uhhh... Pretty sure those are red plums. I know these things now that I am a farmer.
- ^
- Corporate example: AirBnB: https://twitter.com/dinkydani21/status/1559810378774847489
- "Remember kids, always test in production like @Airbnb π" @dinkydani21 August 17, 2022
- ^
- Corporate example: ICICIBank: https://twitter.com/tantragyaana/status/1616311120394084354
- "@ICICIBank be testing in production" @tantragyaana January 20, 2023
- ^
- Corporate example: Vodafone: https://twitter.com/_jp_kumar/status/1614491297242583040
- "This is the proof. Today is no holiday for software engineers.
Vodafone Idea, Please stop your message system testing in production environment. π
#SoftwareEngineer" @_jp_kumar January 15, 2023
- "This is the proof. Today is no holiday for software engineers.
- ^
- Testing In Production Podcast: https://twitter.com/TestInProdCast
- HackerNews discussion of "Do you test in production?" https://twitter.com/hn_frontpage/status/1614388057381441538
- "Ask HN: Do You Test in Production?
C: https://news.ycombinator.com/item?id=34384656" @hn_frontpage January 14, 2023
- "Ask HN: Do You Test in Production?
- 2018-09-27 Segment blog: We test in production. You should too.
- Example: Jet Blue: https://twitter.com/elena_lape/status/1595193229716201474
- "are they testing in production" @elena_lape November 22, 2022
- ^