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