# (WIP) Fixgen - Language agnostic fixture generator Usually wiring up fake test data is a bunch of work, especially when that data is relational. Fixgen helps to alleviate some of that pain by allowing you to very easily generate fixtures that can also reference other fixtures. It also has some nice characteristics: - Zero dependencies - Language agnostic - Dead simple and fast grammar to generate fixtures in minutes - Supports relations - Writing in OCaml ## Usage Simply define a fixgen file, for example sample.fixgen ``` user (2): id uuidv4, name name, email email purchase (10): id uuidv4, buyer user.id, amount int(1,40) ``` And then run it ```sh $ fixgen sample.fixgen -f csv -o fixtures ``` Or just generate in-line: ```sh $ fixgen "user (2): id uuidv4, name name; purchase (10): id uuidv4, buyer user.id, amount int<1,40> ``` For it to generate two files with fake relational data: fixtures/purchase.csv, fixtures/user.csv. Bam! Simple as that. You can then import it into your SQL server with simple copy from commands ``` COPY users FROM '/fixtures/user.csv' CSV HEADER; COPY purchases FROM '/fixtures/purchase.csv' CSV HEADER; ``` Or maybe export as JSON instead to import into your NoSQL DB. ## Development - Prerequisites - [Nix](https://nixos.org/manual/nix/stable/installation/installing-binary) - [Direnv](https://direnv.net/docs/installation.html) After installation, you will need to run direnv allow ``` direnv allow ``` And it will set up the development environment for you with the correct git hooks. ### VSCode You'll need OCaml platform and direnv extension. Once you have those, you will need to start the project from the terminal. First, ensure you have setup code terminal command: https://code.visualstudio.com/docs/setup/mac Once in place, cd to the project and run ``` code . ``` And VSCode should launch correctly with LSP installed. ### Running development ``` ./scripts/run-watch.sh ``` Run tests ``` ./scripts/run-test-watch.sh ``` You can also run them manually: ``` dune runtests ``` ### Building ``` dune build ```