Skip to main content

Testing Strategy

Panduan lengkap untuk testing di MStore Dashboard, termasuk unit tests, component tests, dan E2E tests.

Testing Stack

Test Directory Structure

Setup

Vitest Configuration

Test Setup File

Unit Tests

Testing Utility Functions

Testing Pinia Stores

Testing Composables

Component Tests

Testing Vue Components

Testing Forms

E2E Tests

Playwright Setup

E2E Test Examples

Running Tests

Best Practices

Follow AAA pattern:
  • Mock API calls, not stores
  • Use vi.mock() for module mocks
  • Use createTestingPinia() for store testing
  • Clear mocks between tests
  • Each test should be independent
  • Use beforeEach for setup
  • Clean up after tests
  • Don’t rely on test order

Next Steps

Development Guide

Development best practices

Architecture

Architecture overview