test-data-generation
Test data generation patterns using Bogus, test builders, and ABP seeders. Use when: (1) creating realistic test data, (2) implementing test data seeders, (3)…

Установить test-data-generation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Test Data Generation
Generate realistic test data using Bogus, test builders, and ABP data seeders.
When to Use
- Creating realistic fake data for tests
- Building complex object graphs for testing
- Seeding test databases
- Generating development data
- Creating deterministic test fixtures
Bogus Faker Setup
Installation
<PackageReference Include="Bogus" Version="35.*" />
Basic Faker Configuration
using Bogus;
public static class FakeDataGenerators
{
// Set seed for reproducible tests
public static int Seed { get; set; } = 12345;
static FakeDataGenerators()
{
Randomizer.Seed = new Random(Seed);
}
public static Faker<Patient> PatientFaker => new Faker<Patient>()
.RuleFor(p => p.Id, f => Guid.NewGuid())
.RuleFor(p => p.FirstName, f => f.Name.FirstName())
.RuleFor(p => p.LastName, f => f.Name.LastName())
.RuleFor(p => p.Email, (f, p) => f.Internet.Email(p.FirstName, p.LastName))
.RuleFor(p => p.Phone, f => f.Phone.PhoneNumber("###-###-####"))
.RuleFor(p => p.DateOfBirth, f => f.Date.Past(80, DateTime.Today.AddYears(-18)))
.RuleFor(p => p.Address, f => f.Address.FullAddress())
.RuleFor(p => p.Status, f => f.PickRandom<PatientStatus>());
public static Faker<Doctor> DoctorFaker => new Faker<Doctor>()
.RuleFor(d => d.Id, f => Guid.NewGuid())
.RuleFor(d => d.Name, f => $"Dr. {f.Name.FullName()}")
.RuleFor(d => d.Specialization, f => f.PickRandom(
"Cardiology", "Neurology", "Pediatrics", "Orthopedics"))
.RuleFor(d => d.LicenseNumber, f => f.Random.AlphaNumeric(10).ToUpper())
.RuleFor(d => d.YearsOfExperience, f => f.Random.Int(1, 40));
public static Faker<Appointment> AppointmentFaker => new Faker<Appointment>()
.RuleFor(a => a.Id, f => Guid.NewGuid())
.RuleFor(a => a.DateTime, f => f.Date.Future(30))
.RuleFor(a => a.Duration, f => TimeSpan.FromMinutes(f.PickRandom(15, 30, 45, 60)))
.RuleFor(a => a.Notes, f => f.Lorem.Sentence())
.RuleFor(a => a.Status, f => f.PickRandom<AppointmentStatus>());
}
Advanced Bogus Patterns
public static class AdvancedFakers
{
// Faker with relationships
public static Faker<Appointment> AppointmentWithRelationsFaker(
Guid? patientId = null,
Guid? doctorId = null)
{
return new Faker<Appointment>()
.RuleFor(a => a.Id, f => Guid.NewGuid())
.RuleFor(a => a.PatientId, f => patientId ?? Guid.NewGuid())
.RuleFor(a => a.DoctorId, f => doctorId ?? Guid.NewGuid())
.RuleFor(a => a.DateTime, f => f.Date.Future(30))
.RuleFor(a => a.Status, AppointmentStatus.Scheduled);
}
// Faker with conditional rules
public static Faker<Patient> PatientFakerWithScenario(PatientScenario scenario)
{
var faker = new Faker<Patient>()
.RuleFor(p => p.Id, f => Guid.NewGuid())
.RuleFor(p => p.Name, f => f.Name.FullName())
.RuleFor(p => p.Email, f => f.Internet.Email());
return scenario switch
{
PatientScenario.Adult => faker
.RuleFor(p => p.DateOfBirth, f => f.Date.Past(50, DateTime.Today.AddYears(-18))),
PatientScenario.Minor => faker
.RuleFor(p => p.DateOfBirth, f => f.Date.Past(17, DateTime.Today.AddYears(-1))),
PatientScenario.Elderly => faker
.RuleFor(p => p.DateOfBirth, f => f.Date.Past(30, DateTime.Today.AddYears(-65))),
_ => faker
};
}
// Faker with locale
public static Faker<Patient> BrazilianPatientFaker => new Faker<Patient>("pt_BR")
.RuleFor(p => p.Name, f => f.Name.FullName())
.RuleFor(p => p.Phone, f => f.Phone.PhoneNumber());
// Generate unique values
public static Faker<Patient> UniquePatientFaker => new Faker<Patient>()
.RuleFor(p => p.Id, f => Guid.NewGuid())
.RuleFor(p => p.Email, f => f.Internet.Email().ToLower())
.RuleFor(p => p.SocialSecurityNumber, f => f.Random.Replace("###-##-####"));
}
public enum PatientScenario { Adult, Minor, Elderly }
Test Builder Pattern
Fluent Builder
public class PatientBuilder
{
private readonly Patient _patient;
private readonly Faker _faker = new();
public PatientBuilder()
{
_patient = new Patient
{
Id = Guid.NewGuid(),
Name = _faker.Name.FullName(),
Email = _faker.Internet.Email(),
DateOfBirth = _faker.Date.Past(50, DateTime.Today.AddYears(-18)),
Status = PatientStatus.Active
};
}
public PatientBuilder WithId(Guid id)
{
_patient.Id = id;
return this;
}
public PatientBuilder WithName(string name)
{
_patient.Name = name;
return this;
}
public PatientBuilder WithEmail(string email)
{
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл test-data-generation?
Test data generation patterns using Bogus, test builders, and ABP seeders. Use when: (1) creating realistic test data, (2) implementing test data seeders, (3) building test fixtures, (4) generating fake data for development.
Как установить скилл test-data-generation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл test-data-generation запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
