Dummy Data Creation for QA Testing
Dummy data is essential for testing applications, APIs, databases, and automation scripts. Here are different ways to create dummy data based on the type of testing:
1οΈβ£ Manual Dummy Data Creation (Small Datasets)
π Use Excel, Google Sheets, or Notepad to create small sets of test data.
-
Example for user data:
ID Name Email Age Country 1 John Doe john@example.com 28 USA 2 Jane Roe jane@dummy.com 34 Canada 3 Test User testuser@sample.org 25 India
2οΈβ£ Using Online Tools
π For quick dummy data generation:
π‘ Example JSON Data from Mockaroo:
3οΈβ£ Using Faker Libraries (Automated Data Generation)
π Java (Using Faker Library)
π JavaScript/TypeScript (Faker.js)
π Python (Faker Library)
4οΈβ£ SQL Query for Dummy Data (For Database Testing)
5οΈβ£ API Testing - Mock Data Using Postman
π Use Postmanβs Mock Server or JSON Placeholder API (https://jsonplaceholder.typicode.com)
Example API request:
Response:
6οΈβ£ Generating Dummy Data for Performance Testing (JMeter)
π Using CSV File as Data Source:
-
Create a CSV file with test data (
users.csv
) -
Use CSV Data Set Config in JMeter
-
Parameterize API requests with dummy data
π‘ Conclusion:
β
Small datasets? Use Excel or online tools.
β
Automated scripts? Use Faker in Java, Python, or JavaScript.
β
Database testing? Use SQL queries.
β
API testing? Use Postman or JSON Placeholder.
β
Performance testing? Use JMeter with CSV files.
====================================================================================================================================================
How to Use Mockaroo
Mockaroo - Dummy Data Generation for Testing π
Mockaroo is an online tool that allows testers and developers to generate realistic, structured dummy data for testing. It supports multiple formats like JSON, CSV, SQL, Excel, and more.
πΉ Why Use Mockaroo?
β
Generates realistic test data quickly
β
Supports custom schemas (names, emails, addresses, transactions, etc.)
β
Exports data in multiple formats (JSON, CSV, SQL, XML, etc.)
β
Supports API-based data generation
β
Allows bulk data creation (up to 1M records)
πΉ Steps to Generate Dummy Data Using Mockaroo
1οΈβ£ Go to Mockaroo
π Open https://www.mockaroo.com/
2οΈβ£ Define Your Schema
-
Enter Column Name (e.g., Name, Email, Age, Country)
-
Select Data Type (e.g., First Name, Email Address, Country, etc.)
-
Adjust Row Count (number of records)
πΉ Example Schema:
Column Name | Data Type | Example Output |
---|---|---|
ID | Row Number | 1, 2, 3, ... |
Name | Full Name | John Doe, Alice Smith |
Email Address | john@example.com | |
Age | Number (18-60) | 25, 42, 37 |
Country | Country | USA, Canada, India |
3οΈβ£ Choose Export Format
π Formats: CSV, JSON, SQL, Excel, XML, etc.
4οΈβ£ Download the Data
Click "Download Data" and use it for testing! π
πΉ Using Mockaroo API for Test Automation
Mockaroo provides a REST API for dynamic data generation.
π API Endpoint:
GET https://api.mockaroo.com/api/YOUR_API_KEY?count=10&key=YOUR_API_KEY
π Example Response (JSON Format)
[
{
"id": 1,
"name": "John Doe",
"email": "john.doe@example.com",
"age": 28,
"country": "USA"
},
{
"id": 2,
"name": "Jane Smith",
"email": "jane.smith@example.com",
"age": 34,
"country": "UK"
}
]
πΉ Mockaroo for API Testing (Postman & Jest)
π Mock Data in Jest & Supertest
import request from 'supertest';
const mockData = [
{ id: 1, name: "John Doe", email: "john.doe@example.com" },
{ id: 2, name: "Alice Smith", email: "alice.smith@example.com" }
];
test("Validate mock data", async () => {
expect(mockData[0].name).toBe("John Doe");
expect(mockData[1].email).toContain("@example.com");
});
πΉ Mockaroo for SQL Data Generation
π Generating SQL Insert Queries
Choose SQL format in Mockaroo to generate queries like:
INSERT INTO users (id, name, email, age, country) VALUES
(1, 'John Doe', 'john.doe@example.com', 28, 'USA'),
(2, 'Alice Smith', 'alice.smith@example.com', 34, 'UK');
πΉ When to Use Mockaroo?
β
Manual Testing - Generate Excel/CSV data for test cases
β
API Testing - Use JSON response in Postman/Jest
β
Performance Testing - Generate large datasets
β
Database Testing - Create SQL inserts for testing
Would you like a custom schema for your testing needs? ππ
No comments:
Post a Comment