| title | Quickstart: Data Generator for Testing and Mocking | ||
|---|---|---|---|
| titleSuffix | MSSQL Extension for Visual Studio Code | ||
| description | Learn how GitHub Copilot helps developers quickly create realistic and themed datasets to support SQL database application development, testing, and demos. | ||
| author | croblesm | ||
| ms.author | roblescarlos | ||
| ms.reviewer | randolphwest | ||
| ms.date | 01/19/2026 | ||
| ms.service | sql | ||
| ms.subservice | vs-code-sql-extensions | ||
| ms.topic | quickstart | ||
| ms.collection |
|
||
| ms.custom |
|
||
| ai-usage | ai-assisted |
In this quickstart, you learn how to use GitHub Copilot to create realistic and themed datasets to support application development, testing, and demos. By analyzing the schema and context of your database, GitHub Copilot can generate mock data aligned with real-world formats, simulate edge cases, and reduce the manual effort of seeding databases, making testing faster and more representative of actual scenarios.
[!INCLUDE get-started]
GitHub Copilot can help you generate test and mock data directly from your SQL schema or JSON samples. It offers contextual suggestions to help reduce time and improve coverage, whether you're preparing datasets for demos, testing edge cases, or seeding your development environment with themed or randomized data. These suggestions are especially useful in scenarios where manual data entry would be slow or inconsistent.
Here are common use cases and examples of what you can ask via the chat participant.
Use GitHub Copilot to generate themed, randomized, or representative mock data for your existing tables. You can request specific row counts, apply name/value patterns, or build datasets based on external structures like JSON samples.
Generate mock data for the `SalesLT.Customer` table with 100 sample records.
Populate the `SalesLT.Product` table with 50 items, each with unique names and prices.
Generate mock data for the `SalesLT.SalesOrderHeader` table with 200 records, including order dates and customer IDs.
Based on this sample JSON with four records, generate a SQL table schema and populate it with 50 mock records. Use character names from well-known sci-fi books (for example, Dune, Foundation, Ready Player One) for the `firstName` and `lastName` fields to make the data more realistic and themed:
[
{ "firstName": "Alice", "lastName": "Smith", "email": "alice@example.com" },
{ "firstName": "Bob", "lastName": "Jones", "email": "bob@example.com" },
{ "firstName": "Charlie", "lastName": "Brown", "email": "charlie@example.com" },
{ "firstName": "Dana", "lastName": "White", "email": "dana@example.com" }
]
Go beyond basic data generation by using GitHub Copilot to simulate edge cases and verify your system's behavior. GitHub Copilot can help generate the right data, whether you're stress-testing business logic, checking for data validation failures, or ensuring relational consistency. It can also write assertions or test logic to validate outcomes.
Generate insert statements for `SalesLT.SalesOrderDetail` with `OrderQty` values at the upper boundary (for example, 1,000 units) and verify that the system enforces quantity constraints.
Create test data for `SalesLT.Customer` with invalid email formats and write a query that flags these records for review.
Generate test data for `SalesLT.Product` with edge-case pricing, such as `StandardCost = 0` or negative values, and write a query that highlights anomalies.
Simulate data integrity by generating 500 `SalesOrderDetail` rows that correctly reference valid `ProductID` and `SalesOrderID` values from related tables, and ensure GitHub Copilot includes validation logic.
Write a test script that confirms the `SalesOrderHeader.TotalDue` value is always greater than the `SubTotal` for each order, helpful for spotting miscalculations in business logic.
Using SQLAlchemy, create a test that attempts to insert a `SalesOrderDetail` record with a null `ProductID` and verify that the ORM raises an integrity error due to the foreign key constraint.
With Prisma, generate test logic that tries to insert a `Product` with a `StandardCost` of `-10`. Validate that Prisma rejects the entry and logs an appropriate error message.
[!INCLUDE copilot-feedback]
- GitHub Copilot for MSSQL extension for Visual Studio Code
- Quickstart: Use chat and inline GitHub Copilot suggestions
- Quickstart: Generate code
- Quickstart: Use the schema explorer and designer
- Quickstart: Use the smart query builder
- Quickstart: Query optimizer assistant
- Quickstart: Use the business logic explainer
- Quickstart: Security analyzer
- Quickstart: Localization and formatting helper
- Limitations and known issues