{"repo":"go-testfixtures/testfixtures","free":true,"listed":false,"github":"https://github.com/go-testfixtures/testfixtures","clone":"git clone https://github.com/go-testfixtures/testfixtures.git","description":"Ruby on Rails like test fixtures for Go. Write tests against a real database","language":"Go","stars":1235,"topics":["go","testing","database","fixtures"],"license":"MIT","category":"databases-storage","readme_excerpt":"testfixtures [!WARNING] This package will wipe the database data before loading the fixtures! It is supposed to be used on a test database. Please, double check if you are running it against the correct database. [!NOTE] There are options not described in this README page. It's recommended that you also check [the documentation][doc]. Writing tests is hard, even more when you have to deal with an SQL database. This package aims to make writing functional tests for web apps written in Go easier. Basically this package mimics the [\"Ruby on Rails' way\"][railstests] of writing tests for database applications, where sample data is kept in fixtures files. Before the execution of every test, the test database is cleaned and the fixture data is loaded into the database. The idea is running tests against a real database, instead of relying in mocks, which is boring to setup and may lead to production bugs not being caught in the tests. Installation First, import it like this: Usage Create a folder for the fixture files. Each file should contain data for a single table and have the name .yml : The file would look like this (it can have as many record you want): An YAML object or array will be converted to JSON. It will be stored on a native JSON type like JSONB on PostgreSQL & CockroachDB or as a TEXT or VARCHAR column on other databases. Binary columns can be represented as hexadecimal strings (should start with 0x and will be automatically converted to []byte ): String values matchin","default_branch":null,"files":null,"tree":[],"storefront":"/r/go-testfixtures","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/go-testfixtures/testfixtures/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}