Photo by Danielle-Claude Bélanger / Unsplash

Diff Tool Exercises

Exercises Jan 7, 2025 (Jan 7, 2025) Loading...

Paid subscribers get to play with these exercises together. Join us, Friday 10 January at 1pm, on Zoom.

diff compares two files, highlighting differences. Here's how diff can work for testers. On that page, you'll find links to several tools that implement and build on diff – you may already have your own preference.

In this exercise, you’ll use any diff tool that seems right to you.

This exercise is more fun in a group. If you’re in a group, please talk about what tool you’d use. Perhaps re-run the exercise with someone else’s tool of choice, or with someone else.

The solutions are below. The tool will do most of the work – give yourself kudos for spotting non-trivial things. Zero kudos if you look at the solutions before trying the exercises.

Exercises Group 1 – XML

Download the linked files, use them in a tool.

If you’re opening the file in a browser, finding out what an xmlschema is, and reading through it, you’re doing it …differently from how I’d expect you to do it.

Exercise 1.1

 file 1file 2

Solution

Exercise 1.1 - Lines Removed

in the schema definition, v2 is missing these lines, location 453 in original

<xs:element name="BkPtyId" type="Max35Text" minOccurs="0" maxOccurs="1"/>
<xs:element name="TaxIdNb" type="Max35Text" minOccurs="0" maxOccurs="1"/>

Exercise 1.2

 file 1file 2

Solution

Exercise 1.2 - Lines Added

In the schema definition, v2 has had line 699 duplicated in error

</xs:complexType>

Exercise 1.3

 file 1file 2

Solution

Exercise 1.3 - Lines Rearranged

In the schema definintion on lines 224 to 234 of v2, SimpleType DocumentType2Code has been rearranged. Kudos if you recognised that it has been sorted

<xs:enumeration value="CINV"/>
<xs:enumeration value="CMCN"/>
<xs:enumeration value="CNFA"/>
<xs:enumeration value="CREN"/>
<xs:enumeration value="DEBN"/>
<xs:enumeration value="DISP"/>
<xs:enumeration value="DNFA"/>
<xs:enumeration value="HIRI"/>
<xs:enumeration value="MSIN"/>
<xs:enumeration value="SBIN"/>
<xs:enumeration value="SOAC"/>

Exercise 1.4

 file 1file 2

Solution

Exercise 1.4 Information Changed On A Single Line

In the schema definition on line 463, the order of attributes has been rearranged. Kudos if you noticed that maxOccurs has changed from 4 to 5

<xs:element name="PrvtId" minOccurs="1" maxOccurs="5" type="PersonIdentification3" />

Exercise 1.5

file 1file 2

Solution

EXERCISE 1.5 - LINES SPLIT

In the schema definition on line 165, the line has been split by tag.

Kudos if you noticed that there’s an extra attribute base, that the tag is no longer closed with /> but ends with a >, and that the name attribute is now ccy rather than Ccy

<xs:attribute 
	name="ccy" 
	type="CurrencyCode" 
	base="xs:string"
	use="required">

Exercise 1.6

file 1file 2

Solution

Exercise 1.6 - Lines Joined

In the schema definition, line 278 has been joined with line 279. Kudos if you noticed the spelling of elemnet, the absence of capitalisation in both pairs of maxoccurs and minoccurs, and at least one spellign error.

<xs:element name="ClrSysMmbId" type="ClearingSystemMemberIdentification3Choice" minoccurs="0" maxoccurs="1"/><xs:elemnet name="Nm" type="Max70Text" minocurrs="0" maxoccurs="1"/>

«JL: Add more, in JSON and CSV and TXT (i.e. dir list)»

Planned exercises include...

Exercises Group 2 – Code and config

Python, JavaScript, YAML/TOML, env

Exercises Group 3 – Markdown

Docs and readme.

Exercises Group 3 – Folders

Changed content, added / removed, renamed / moved, timestamp, permissions, ?encoding, ?os-specific metadata, ?hash,

Exercises Group 4 – Combos

sort / grep / filter – first, within git and across files for a commit, on directory / process lists, getting unique / count of changes,


This page is a work in progress. I'm sure that a curious reader can easily find my notes to myself. «JL: perhaps, if the script finds any notes, it can insert this message?»

Member reactions

Reactions are loading...

Sign in to leave reactions on posts

Tags

Comments

Sign in or become a Workroom Productions member to read and leave comments.

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.