Wednesday, April 2, 2025

QA: How we can generate the test data? dummy test data for manual/automation testing

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.


2️⃣ Using Online Tools

πŸ“Œ For quick dummy data generation:

πŸ’‘ Example JSON Data from Mockaroo:

json
[ { "id": 1, "name": "John Doe", "email": "john.doe@example.com", "age": 29, "country": "USA" }, { "id": 2, "name": "Alice Smith", "email": "alice.smith@example.com", "age": 35, "country": "UK" } ]

3️⃣ Using Faker Libraries (Automated Data Generation)

πŸ“Œ Java (Using Faker Library)

java
import com.github.javafaker.Faker; public class DummyDataGenerator { public static void main(String[] args) { Faker faker = new Faker(); System.out.println("Name: " + faker.name().fullName()); System.out.println("Email: " + faker.internet().emailAddress()); System.out.println("Phone: " + faker.phoneNumber().cellPhone()); } }

πŸ“Œ JavaScript/TypeScript (Faker.js)

javascript
import { faker } from '@faker-js/faker'; console.log({ name: faker.person.fullName(), email: faker.internet.email(), phone: faker.phone.number(), });

πŸ“Œ Python (Faker Library)

python
from faker import Faker fake = Faker() print(f"Name: {fake.name()}, Email: {fake.email()}, City: {fake.city()}")

4️⃣ SQL Query for Dummy Data (For Database Testing)

sql
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', 32, 'UK'), (3, 'Robert Brown', 'robert.brown@example.com', 40, 'Canada');

5️⃣ API Testing - Mock Data Using Postman

πŸ“Œ Use Postman’s Mock Server or JSON Placeholder API (https://jsonplaceholder.typicode.com)

Example API request:

http
GET https://jsonplaceholder.typicode.com/users

Response:

json
[ { "id": 1, "name": "Leanne Graham", "username": "Bret", "email": "leanne@example.com" } ]

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 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