`diff` for Testers
diff
helps you to compare two similar texts.
It's great for seeing what's changed in code or in data. It will compare two directories, recursively if you ask. It’s best on text things, and not a lot of use for binaries (though if you know tricks, teach me). Some diff tools will compare specific kinds of binary files; word and excel docs, jpgs and more – these are useful, but tend to be proprietary and I won't cover them here.
You’ll use a diff tool on any text thing longer than a paragraph. Even a paragraph, sometimes. You’ll use it when you have two versions - or when you suspect you have two versions rather than twins. You’ll find differences due to direct action by a person, by generators, by tools, by time, and by corruption. And more.
You already know diff. You’ve seen it in GitHub and other collaborative coding environments. You’ve seen tools like it in Word and other collaborative writing environments.
Diff tools tell you that a line has changed. Many don’t tell you how a line has changed. None tell you if the information still makes sense, or has stayed consistent.
diff
is a unix tool: a mandatory part of the available parts that let an OS describe itself as unix-like – it's been remade several times, and there are several tools that build on diff
or are diff
-like. See below.
Use it for
- Identifying code changes, to look for unexpected changes
- Checking differences in database dumps
- Looking for changes to environmental variables
- Seeing how two output records differ
- Seeing what changed in your input data when the system will no longer ingest it
- Looking for changes to configuration
- Looking to see which files in a directory have changed
- Checking that your commit is committing only what you want to commit
- Seeing what's stayed the same in the monthly report to identify where an update hasn't happened
- Looking for textual changes to requirements
- Browsing two versions of a contract
...and more. If you don't have it in your toolkit, you're blinding yourself.
Sources
The man
page is https://www.man7.org/linux/man-pages/man1/diff.1.html
Opengroup page https://pubs.opengroup.org/onlinepubs/9799919799/utilities/diff.html
Wikipedia page https://en.wikipedia.org/wiki/Diff
Tool Examples
Basic diff
tools are very command-line, and can be used easily in chains of other tools. If you’re going command-line, you’re old enough to hold your own hand.
Some are more visually friendly, and can be used by a broader group of people.
- Here are a couple of web-based tools. DiffChecker, Diff-text.
- Here’s a (commercial) list of common dif tools for Windows
- and more Diff Tools on Mac.
- Windows machines typically have kDiff3 and I believe that meld is often available. My Mac hasDeltaWalker and FileMerge. Dev teams often seem to have a license for cross-platform Beyond Compare.
Comments
Sign in or become a Workroom Productions member to read and leave comments.