Testing

This guide covers testing KayakNet during development and for quality assurance.

Test Types

Unit Tests

Test individual functions and components:

# Run all unit tests
go test ./...

# With verbose output
go test -v ./...

# Specific package
go test ./internal/chat/...

# With coverage
go test -cover ./...

Integration Tests

Test component interactions:

End-to-End Tests

Test complete user flows (manual):

  1. Start bootstrap node

  2. Start test nodes

  3. Perform actions

  4. Verify results

Running Tests

Quick Test

Full Test Suite

Specific Tests

Test Coverage

Generate Report

Coverage Goals

Package
Target

crypto

90%+

e2e

85%+

chat

80%+

market

80%+

escrow

85%+

Writing Tests

Test Structure

Table-Driven Tests

Mocking

Manual Testing

Local Network Setup

Test Scenarios

Chat Test

  1. Node A joins room #test

  2. Node B joins room #test

  3. Node A sends message

  4. Verify Node B receives message

Marketplace Test

  1. Node A creates listing

  2. Node B searches for listing

  3. Verify listing appears

  4. Node B creates order

  5. Verify escrow created

Domain Test

  1. Node A registers test.kyk

  2. Node B looks up test.kyk

  3. Verify resolution

Browser Testing

Setup

  1. Start node with --proxy

  2. Configure browser proxy to 127.0.0.1:8118

  3. Navigate to http://home.kyk

Test Cases

Feature
Test

Homepage

Loads correctly

Chat

Send/receive messages

Marketplace

Browse listings

Domains

Search works

Escrow

Create order

Performance Testing

Load Test

Benchmark Tests

Run benchmarks:

CI/CD Integration

GitHub Actions

Debugging Tests

Verbose Output

With Logging

Debugging Failures

Last updated