AgentSkillsCN

Test Suite Generator

测试套件生成器

SKILL.md

Test Suite Generator Skill

Purpose

Automatically generate comprehensive test suites for iOS applications. This skill creates unit tests, UI tests, integration tests, and performance tests with proper mocking and test data.

Capabilities

  • Generate unit tests from service implementations
  • Create protocol-based mock objects
  • Generate UI test scenarios from screen flows
  • Build test data factories
  • Create performance benchmarks
  • Generate integration test suites
  • Add snapshot tests for UI components

Usage

When creating tests, I will:

  1. Analyze the code structure to understand what needs testing
  2. Generate appropriate test cases covering success and failure paths
  3. Create mock implementations for dependencies
  4. Build test data factories for consistent test data
  5. Generate UI tests for critical user flows
  6. Add performance benchmarks where appropriate

Common Tasks

Generate unit tests

python
python unit_test_generator.py --class Services/OrderService.swift --output Tests/

Generate mocks

python
python mock_generator.py --protocol NetworkServiceProtocol --output Mocks/

Generate UI tests

python
python ui_test_generator.py --flow checkout --output UITests/

Generate test data

python
python test_data_factory.py --model Order --output TestData/

Resources

  • unit_test_generator.py - Generate unit tests from implementations
  • mock_generator.py - Create mock objects from protocols
  • ui_test_generator.py - Generate UI test scenarios
  • test_data_factory.py - Build test data factories
  • performance_test_generator.py - Create performance tests
  • templates/ - Test code templates

Test Types Generated

Unit Tests

  • Service method tests
  • Model validation tests
  • Utility function tests
  • Error handling tests

UI Tests

  • User flow tests
  • Screen navigation tests
  • Form validation tests
  • Accessibility tests

Integration Tests

  • API integration tests
  • Database tests
  • Service interaction tests

Performance Tests

  • Method performance
  • Memory usage
  • UI responsiveness

Best Practices

  1. Test both success and failure paths
  2. Use descriptive test names
  3. Keep tests independent
  4. Use factories for test data
  5. Mock external dependencies
  6. Add performance baselines