Sample files for parser and importer testing
Well-formed files and deliberate edge cases for testing code that reads CSV, JSON, XML, PDF and more.
A parser is tested by what it is fed. Clean input shows that the common path works; awkward but valid input shows whether the parser follows the format or merely an optimistic idea of it.
The curated library contains files built around the features that hand-written parsers most often mishandle: quoted CSV fields, byte order marks, XML namespaces and CDATA, deeply nested JSON and multipart email.
Recommended files
| File | Size | Why this one | Download |
|---|---|---|---|
| CSV with quoted fields, embedded commas and line breakssample-csv-quoted-fields.csv | 324 B324 bytes | RFC 4180 quoting rules | Download CSV |
| CSV with a UTF-8 byte order mark and non-ASCII textsample-csv-utf8-bom.csv | 193 B193 bytes | Byte order mark | Download CSV |
| Sample product catalogue XML with namespaces and CDATAsample-product-catalog.xml | 1.07 KB1,100 bytes | Namespaces, CDATA and entities | Download XML |
| Nested JSON with every value typesample-nested-config.json | 829 B829 bytes | All JSON types and deep nesting | Download JSON |
| 10 MB CSV samplesample-csv-10mb.csv | 10 MB10,485,760 bytes | Volume test | Download CSV |
| 5 MB JSONL samplesample-jsonl-5mb.jsonl | 5 MB5,242,880 bytes | Streaming test | Download JSONL |
Checklist
Parse the clean file
Confirm record counts and a few known values. Each download page states how many records a file holds.
Parse the edge cases
Quoted fields, embedded line breaks, a byte order mark, different delimiters, non-ASCII text.
Scale up
Move to 1 MB, then 10 MB. Watch memory as well as time: reading everything at once is the usual fault.
Truncate deliberately
Cut a file in half and check that the parser reports an error instead of returning partial data as if it were complete.
Guides
- Building a QA test file kit
The files every tester should keep ready, organised into baseline, boundary and edge-case sets.
- How to test MIME types and file type validation
Extensions, Content-Type headers and magic bytes: how to check that type validation cannot be fooled.
- What is a PDF file? Structure, versions and how to test with one
How a PDF is put together, how to recognise one from its bytes, and what that means for testing.
Related use cases
Frequently asked questions
- How do I make a truncated file?
- Use head -c with a byte count, for example head -c 5000 sample-json-10kb.json > truncated.json. The result is invalid JSON by construction.