![]() Similar to the previous article, if you're using an Object-Relational Mapping (ORM) library, then you'll probably create and persist objects into the database using the ORM or use the ORM to dump and restore test data fixtures using JSON or CSV. Unless you already have a large dataset from a production environment or a partner company that you can use (hopefully after anonymization!), generating test data is the only way to get large datasets for benchmarking and load testing. Generating data per test can make such pre-conditions more explicit and clear, especially for colleagues who inherit your tests and test data in the future. As an example, if you're testing an e-commerce website and your test suite uses hard-coded product details and deactivating the product in your test dataset causes many tests to unexpectedly fail, then those tests were reliant on a pre-condition that happened to be satisfied in your test dataset. The first option is tedious, and the second option can be brittle. I would argue this is better than the alternatives of (a) hand-creating data per test or (b) trying to maintain a single dataset that is used across the entire test suite. Tools for generating test data make it easier to set up data per test. Writing the logic for generating test data forces you to take a second look at your data model and consider what values are allowed and which values are edge cases. Generating test data, rather than using static manually-created data, can be valuable for a few reasons: ![]() After exploring various ways to (), I wanted to dive into different approaches for *generating* test data for PostgreSQL.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |