A sign-up form
A hundred sign-ups for a Polish form, with one thing the form should catch ordered in about a fifth of them.
pl-PL 1 table 100 rows CSV damage L2, L4
The recipe says what the form expects: names are required and have a longest length, and the PESEL agrees with the birth date and the gender. The damage breaks those rules one at a time, so every refused row has a single cause. The manifest says each damaged value should be rejected, and the clean rows should go through.
The recipe
# Sign-ups for a Polish form, with one thing the form should catch asked for in
# about a fifth of them.
#
# Names are required and have a longest length, and the PESEL has to agree with
# the birth date and the gender. The damage breaks rules like these, such as a
# name past its longest length or a PESEL that disagrees with the birth date or
# the gender beside it. The manifest names every broken value and says your form
# should reject it. It also lists the damage this build could not carry out,
# with the reason.
#
# qadg generate form-validation.yaml
#
# writes signup.csv, expectation-manifest.json and run-note.json. The same seed
# breaks the same values on every machine.
version: "0.1"
seed: "form-validation"
locale: pl-PL
entities:
signup:
count: 100
primary_key: [pesel]
fields:
first_name: { generator: first_name, required: true, max_length: 30 }
last_name: { generator: last_name, required: true, max_length: 40 }
gender: { generator: gender }
birth_date: { generator: birth_date }
pesel: { generator: pesel, required: true }
consistency:
- first_name matches: [gender]
- pesel matches: [birth_date, gender]
policy:
layers: [L2, L4]
rows: 20%
per_row: exactly_one
output:
format: csv
Run it
Save the recipe, then run this in the same folder. This is what the program printed for it.
$ qadg generate form-validation.yaml signup: 100 rows, 5 columns signup: last_name follows gender, though no rule says so 1 table, 100 rows written 12 defects ordered, 3 applied, manifest in expectation-manifest.json 9 defects could not be applied, and the manifest carries the reason for each one 1 because the dataset has no column of the kind they apply to 8 because this build has no implementation of them yet
What it writes
signup.csv
The first 5 of its 100 rows.
| first_name | last_name | gender | birth_date | pesel |
|---|---|---|---|---|
| Karina | Lipińska | kobieta | 1987-08-24 | 87082469583 |
| Konstanty | Sobisz | mężczyzna | 2007-06-17 | 07261758439 |
| Mieszko | Spólnik | mężczyzna | 1999-07-12 | 99071282154 |
| Norbert | Majczyna | mężczyzna | 1987-01-10 | 87011033652 |
| Eliza | Samson | kobieta | 1957-08-06 | 57080687562 |
expectation-manifest.json
Every defect the recipe ordered: where it is, the value before and after, and what your application should do with it. A defect this build could not apply is there too, with the reason.
run-note.json
The seed, the locale and the versions behind the run, and every table it wrote with its rows and columns.
What it damaged
The recipe ordered 12 defects, and this build applied the 3 below. The other 9 are in the manifest as not applied, each with its reason, and the run above counts them by reason.
L2.string.exceeds_maxlengthrejectsignup 11, column last_name
Klemczak → Klemczakkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
L4.coherence.national_id_vs_birthdate~ rejectsignup 72, column pesel
35092417472 → 40092417476
L4.coherence.national_id_vs_gender~ rejectsignup 88, column pesel
01320155821 → 01320155838