Formularz rejestracji

Sto rejestracji do polskiego formularza, z jedną rzeczą do wyłapania zamówioną w mniej więcej co piątej z nich.

pl-PL 1 tabela 100 wierszy CSV psuje L2, L4

Przepis mówi, czego formularz oczekuje: imię i nazwisko są wymagane i mają największą długość, a PESEL zgadza się z datą urodzenia i płcią. Uszkodzenia łamią te reguły po jednej naraz, więc każdy odrzucony wiersz ma jedną przyczynę. Manifest mówi, że każdą zepsutą wartość trzeba odrzucić, a czyste wiersze mają przejść.

Przepis

form-validation.yaml
# 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

Uruchomienie

Zapisz przepis i w tym samym folderze uruchom to polecenie. Niżej jest to, co program przy nim wypisał.

terminal
$ 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

Co zapisuje

signup.csv

Pierwsze 5 z 100 wierszy.

first_namelast_namegenderbirth_datepesel
KarinaLipińskakobieta1987-08-2487082469583
KonstantySobiszmężczyzna2007-06-1707261758439
MieszkoSpólnikmężczyzna1999-07-1299071282154
NorbertMajczynamężczyzna1987-01-1087011033652
ElizaSamsonkobieta1957-08-0657080687562

expectation-manifest.json

Każde uszkodzenie zamówione przez przepis: gdzie jest, wartość przed i po oraz co ma z nią zrobić twoja aplikacja. Uszkodzenie, którego ta wersja nie umiała zastosować, też tu jest, z powodem.

run-note.json

Seed, locale i wersje, z którymi ruszył przebieg, oraz każda zapisana tabela z liczbą wierszy i kolumn.

Co zepsuł

Zamówione uszkodzenia: 12. Zastosowane przez tę wersję: 3, opisane niżej. Niezastosowane: 9, każde jest w manifeście z powodem, a przebieg wyżej liczy je według powodu.

L2.string.exceeds_maxlengthodrzucić

signup 11, kolumna last_name

Klemczak → Klemczakkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk

L4.coherence.national_id_vs_birthdate~ odrzucić

signup 72, kolumna pesel

35092417472 → 40092417476

L4.coherence.national_id_vs_gender~ odrzucić

signup 88, kolumna pesel

01320155821 → 01320155838