← back to Wine Finder Next

TEST_README.md

155 lines

# Test Suite - README

## Quick Start

```bash
# 1. Install dependencies
npm install

# 2. Run all tests
npm run test:all

# 3. View coverage
npm run test:coverage
open coverage/lcov-report/index.html
```

## What's Included

This comprehensive test suite includes:

- **190+ tests** across 5 categories
- **3,130+ lines** of test code
- **70%+ coverage** target
- **CI/CD integration** with GitHub Actions
- **Complete documentation** (4 guides)

## Test Categories

| Category | Tests | Command |
|----------|-------|---------|
| Unit | 70+ | `npm run test:unit` |
| Integration | 30+ | `npm run test:integration` |
| Security | 50+ | `npm run test:security` |
| Performance | 15+ | `npm run test:performance` |
| E2E | 25+ | `npm run test:e2e` |

## Files Overview

```
/__tests__/
  /unit/                 # Core logic tests
  /integration/          # API tests
  /security/             # Vulnerability tests
  /performance/          # Load tests
  /fixtures/             # Mock data
  /helpers/              # Test utilities

/e2e/                    # End-to-end tests

/TEST_*.md               # Documentation
```

## Key Features Tested

### Membership Platform
- Bottle purchase flow
- Share trading
- Governance voting
- Marketplace operations
- Sample fulfillment

### Security
- SQL Injection prevention
- XSS prevention
- CSRF protection
- Rate limiting
- Input validation

### Performance
- API response < 500ms
- Concurrent users (100+)
- Memory leak detection
- Load testing

### User Experience
- Mobile responsiveness
- Accessibility (ARIA, keyboard)
- Error handling
- Cross-browser compatibility

## Documentation

1. **TESTING_QUICK_START.md** - Get started quickly
2. **TEST_SUITE_DOCUMENTATION.md** - Complete reference
3. **TEST_SUMMARY.md** - Test overview
4. **COMPREHENSIVE_TEST_OVERVIEW.md** - Detailed breakdown

## Running Tests

### Development
```bash
npm test                 # Watch mode
```

### Specific Category
```bash
npm run test:unit
npm run test:integration
npm run test:security
npm run test:performance
npm run test:e2e
```

### Coverage
```bash
npm run test:coverage
```

### E2E with UI
```bash
npm run test:e2e:ui
```

### Using Test Runner
```bash
./run-tests.sh all       # All tests
./run-tests.sh unit      # Unit only
./run-tests.sh help      # See options
```

## CI/CD

Tests run automatically on:
- Push to `main` or `develop`
- Pull requests
- Manual workflow dispatch

Pipeline includes:
- Unit & integration tests
- Security scanning
- Performance benchmarks
- E2E testing (3 browsers)
- Coverage reporting

## Next Steps

1. Read **TESTING_QUICK_START.md** for details
2. Run `npm run test:coverage` to see current coverage
3. Run `npm run test:e2e:ui` to see E2E tests in action
4. Check **TEST_SUITE_DOCUMENTATION.md** for best practices

## Support

For questions or issues:
1. Check documentation files
2. Review existing tests for patterns
3. See CI/CD logs for failures

---

**Status**: Production Ready
**Version**: 1.0.0
**Tests**: 190+
**Coverage**: 70%+ target