The Deska blog
Generating Fixtures and Sample Data with AI Agents
Learn how to use AI coding agents for generating fixtures and sample data to streamline development, improve test coverage, and automate repetitive tasks.
· 10 min read
Generating fixtures and sample data is a fundamental yet time consuming part of the software development lifecycle. Without realistic data, testing edge cases and verifying UI states becomes a manual burden that slows down delivery. By leveraging AI coding agents within a modern development environment, engineers can automate the creation of complex datasets that mirror production structures without compromising security or privacy.
The Role of Fixtures in Modern Development
Fixtures serve as the baseline state for software tests. They ensure that every time a test runs, it starts from a known, repeatable configuration. Historically, developers wrote these by hand or used libraries like Faker to procedurally generate fields. While effective for simple objects, hand-written fixtures often fail to capture the relational complexity of real world databases.
Sample data extends this concept beyond unit tests. It is essential for populating staging environments, demonstrating features to stakeholders, and testing performance at scale. When the data is too simplistic, developers may miss bugs related to pagination, search relevance, or UI layout shifts caused by varying text lengths.
Traditional Approaches vs AI Generation
Before the advent of large language models, teams relied on a few standard methods for data seeding.
- Manual JSON/YAML files: High precision but very difficult to maintain as the schema evolves.
- Scripted generators: Libraries like FactoryBot or Faker provide randomization but require constant updates to logic.
- Database snapshots: These offer high realism but pose significant security risks if sensitive user information is not properly scrubbed.
AI agents offer a fourth path. Because an agent can read your existing schema and understand the context of your application, it can generate data that is not just random, but logically consistent across multiple tables or services. For example, an agent can ensure that a "CreatedDate" is always prior to a "LastLoginDate" across thousands of generated records.
Using AI Agents for Data Orchestration
AI coding agents like Claude Code or OpenCode can be integrated directly into the workspace to handle data generation tasks. Instead of writing a script to populate a database, a developer can prompt the agent to analyze a schema.sql file and produce five hundred realistic user profiles in a specific format.
Within Deska, these agents run as coding agents in dedicated panels. This allows the developer to keep the schema definition open in one panel while the agent executes the generation script in a terminal panel next to it. This side by side view helps in verifying that the generated fixtures align with the expected data types and constraints.
Improving Relational Integrity
One of the hardest parts of generating sample data is maintaining foreign key relationships. If you generate a list of "Orders," each order must point to a valid "User" ID. An AI agent can be instructed to first generate the parent entities, store their IDs in memory, and then use those IDs when creating child records. This multi-step reasoning is where agents outperform traditional static libraries.
Integrating Deska into the Workflow
Deska provides an infinite canvas where you can organize the various components of your data generation strategy. Because it is local-first, the code and the data generated stay on your machine, which is critical when working with proprietary schemas.
You can set up a workspace that includes:
- A code editor panel showing your models or database migration files.
- Multiple terminals running different AI agents to compare their output.
- A browser panel to view a local admin dashboard as the data is injected.
If you need to move away from your desk while a large data generation script is running, the mobile app allows you to monitor the terminal output through a secure relay. You can check the progress of your fixtures without being tethered to your workstation.
Comparison of Generation Strategies
| Strategy | Speed | Realism | Maintenance | Security |
|---|---|---|---|---|
| Manual Entry | Slow | High | High | Safe |
| Faker Libraries | Fast | Low | Medium | Safe |
| DB Anonymization | Medium | Highest | High | Risky |
| AI Agent | Fast | High | Low | Safe |
While AI agents are powerful, they differ in approach from traditional seeding scripts. A script is deterministic, meaning it produces the same result every time given the same seed. An agent is probabilistic. This is beneficial for discovering edge cases, such as very long names or unusual character sets, that a developer might not think to include in a standard script.
Automating Edge Case Discovery
A significant advantage of generating fixtures with AI is the ability to specifically request "broken" or "stressful" data. You can ask an agent to generate data that tests the limits of your application.
- Strings with maximum allowable length to test UI overflow.
- Dates in different time zones to verify UTC conversions.
- Special characters and emojis to test database encoding.
- Negative values in fields where only positives are expected to test validation logic.
By using Ask Deska, you can use voice commands to trigger these generation cycles. For instance, you could say "Ask Deska to run the fixture generator with the edge case configuration," and the assistant will interact with the coding agents and terminals to execute the task.
Common Challenges and Solutions
When generating sample data, developers often encounter issues with volume and consistency. Generating ten records is easy, but generating ten thousand can lead to memory issues or rate limits if the AI is generating each record individually.
To solve this, use the agent to write a high performance generation script (in Python or Go) rather than having the agent output the data directly in the chat. This script can then be executed locally in a Deska terminal. This approach combines the intelligence of the AI with the execution speed of local compiled code.
Managing Large Datasets
Large fixture files can bloat a git repository. It is often better to store the generation prompts or scripts rather than the output files. When a new developer joins the project, they can run the agent or the script to recreate the necessary sample data locally.
FAQ
How to generate realistic sample data for testing?
To generate realistic sample data, provide an AI agent with your database schema or TypeScript interfaces. Ask it to generate records that follow specific business logic, such as realistic names, addresses, and logical timestamps. Running these agents in a local-first environment like Deska ensures your schema remains private.
Can AI agents create relational database fixtures?
Yes, AI agents are capable of understanding relationships between tables. By analyzing foreign key constraints, an agent can generate parent and child records in the correct order to maintain referential integrity. This is more efficient than manual entry or basic randomization libraries.
What are the best tools for generating test fixtures?
The best tools include libraries like Faker for simple data, or AI agents like Claude Code and OpenCode for complex, context-aware datasets. Using these agents within an integrated workspace like Deska allows you to manage the generation process alongside your code and terminals.
Get Started with Automated Fixtures
Automating the generation of fixtures and sample data reduces the friction of manual testing and ensures your development environment reflects the complexities of the real world. By integrating AI agents into your daily workflow, you can focus on building features rather than formatting JSON files.
To explore how an infinite canvas and AI panels can improve your development speed, download Deska for your platform today. Experience a local-first environment where your tools and agents work together seamlessly.