๐Ÿงช Automated Testing Guide

Complete guide to workout scenarios and test automation

๐Ÿ“š Table of Contents

๐ŸŽฏ Testing Overview

The fitness sensor testing framework provides three ways to run automated tests:

iOS App

Visual, interactive testing with real-time progress

Easiest

Python Script

Command-line automation for CI/CD pipelines

Most Flexible

Manual Control

Direct Matter commands for debugging

Advanced

What Gets Tested

๐Ÿ‹๏ธ Available Test Scenarios

1. HIIT Intervals (30 minutes)

Purpose: Test rapid intensity changes and recovery

Profile: 4ร—4min high intensity with 3min recovery

Warm-up (5m) โ†’ Interval 1 (4m) โ†’ Recovery (3m) โ†’ 
Interval 2 (4m) โ†’ Recovery (3m) โ†’ Interval 3 (4m) โ†’ 
Recovery (3m) โ†’ Interval 4 (4m) โ†’ Cool-down (5m)

Power Range: 115W - 327W

Heart Rate Range: 92 - 171 BPM

2. Endurance Ride (45 minutes)

Purpose: Test sustained steady-state output

Profile: Consistent moderate intensity

Warm-up (5m) โ†’ Steady State (35m) โ†’ Cool-down (5m)

Power Range: ~225W steady

Heart Rate Range: ~130 BPM steady

3. Recovery Spin (20 minutes)

Purpose: Test low-intensity baseline

Profile: Easy spin at minimal output

Easy Spin (20m)

Power Range: ~91W

Heart Rate Range: ~76 BPM

4. Pyramid Intervals (25 minutes)

Purpose: Test progressive intensity ramps

Profile: 1-2-3-2-1 minute intervals

Warm-up โ†’ 1min โ†’ Rest โ†’ 2min โ†’ Rest โ†’ 
3min โ†’ Rest โ†’ 2min โ†’ Rest โ†’ 1min โ†’ Cool-down

Power Range: 115W - 350W

Heart Rate Range: 92 - 189 BPM

5. Tabata Protocol (4 minutes)

Purpose: Test maximum intensity sprints

Profile: 8ร—(20s sprint, 10s rest)

Warm-up (2m) โ†’ [20s max / 10s rest] ร— 8 โ†’ Cool-down (2m)

Power Range: 50W - 387W

Heart Rate Range: 60 - 197 BPM

View All 10 Test Scenarios โ†’
Name Duration Purpose Complexity
HIIT Intervals 30m Rapid changes Medium
Endurance 45m Steady state Easy
Recovery 20m Low intensity Easy
Pyramids 25m Progressive ramps Medium
Tabata 4m Max sprints Hard
FTP Test 25m Threshold power Medium
Warm-up 10m Gradual builds Easy
Sweet Spot 40m Sub-threshold Medium
VO2 Max 30m High intensity Hard
Ramp Test 15m Progressive overload Medium

๐Ÿ“ฑ iOS App Testing

Getting Started

  1. Open FitnessSensorController app
  2. Tap your sensor from the device list
  3. Scroll down and tap "Test Workouts"
  4. Browse list of scenarios

Running a Workout

  1. Select any workout scenario
  2. Review segment breakdown
  3. Tap "Start Workout"
  4. Monitor real-time progress:
    • Overall progress bar
    • Current segment name
    • Estimated power & HR
    • Time remaining
  5. Use controls as needed:
    • Pause - Temporarily stop
    • Stop - End early
    • Skip - Next segment

Example Progress Display

Overall: 45%
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘
13:30 / 16:30

Current: Interval 2
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘
โšก 327W | โค๏ธ 171 BPM
2:43 remaining

Quick Test Suite

Test all scenarios in 2 minutes:

  1. Tap "Test Workouts"
  2. Tap "Run Quick Test Suite"
  3. Wait ~2 minutes
  4. View results: โœ… 10/10 passed

๐Ÿ’ป Command Line Testing

Installation

# Install dependencies
pip install colorama tabulate

# Install Matter chip-tool (if not already installed)
# See: https://github.com/project-chip/connectedhomeip

Basic Usage

List Available Workouts

python test_automation.py --list

๐Ÿ“‹ Available Workout Scenarios:

  intervals    - HIIT Intervals
               4x4 minute high intensity with recovery
               Duration: 30:00, Segments: 9

  endurance    - Endurance Ride
               Steady state for 45 minutes
               Duration: 45:00, Segments: 3
  ...

Run a Specific Workout

# Run HIIT intervals
python test_automation.py --workout intervals

# Run Tabata with custom node ID
python test_automation.py --workout tabata --node-id 2

# Dry run (no commands sent)
python test_automation.py --workout ftp --dry-run

Quick Test All Scenarios

python test_automation.py --all

๐Ÿงช Running Quick Test Suite

Testing HIIT Intervals... โœ… PASS
Testing Endurance Ride... โœ… PASS
Testing Recovery Spin... โœ… PASS
...
Test Results: 10/10 passed

Advanced Options

# Full command with all options
python test_automation.py \
    --workout intervals \
    --node-id 1 \
    --endpoint 1 \
    --verbose \
    --dry-run
Option Description
--workout, -w Workout name (intervals, endurance, etc.)
--list, -l List all available workouts
--all, -a Quick test all scenarios
--custom, -c Load custom workout from JSON
--node-id, -n Matter node ID (default: 1)
--endpoint, -e Matter endpoint ID (default: 1)
--dry-run, -d Simulate without sending commands
--verbose, -v Detailed output

๐ŸŽจ Custom Workouts

JSON Format

Create a custom workout file (my_workout.json):

{
  "name": "My Custom Workout",
  "description": "Custom test scenario",
  "segments": [
    {
      "name": "Warm-up",
      "duration": 300,
      "intensity": 100,
      "notes": "5 minutes at low intensity"
    },
    {
      "name": "Build Power",
      "duration": 180,
      "intensity": 120
    },
    {
      "name": "Threshold",
      "duration": 600,
      "intensity": 180
    },
    {
      "name": "Recovery",
      "duration": 300,
      "intensity": 70
    },
    {
      "name": "Sprint",
      "duration": 30,
      "intensity": 254
    },
    {
      "name": "Cool Down",
      "duration": 300,
      "intensity": 60
    }
  ],
  "metadata": {
    "author": "Your Name",
    "created": "2025-01-15"
  }
}

Field Reference

Field Type Required Description
name string โœ… Segment name
duration integer โœ… Duration in seconds
intensity integer โœ… Intensity level (0-254)
notes string โŒ Optional description

Intensity Mapping

Intensity Power Heart Rate Zone
0 50W 60 BPM Recovery
50 118W 87 BPM Easy
100 187W 115 BPM Endurance
127 225W 130 BPM Tempo (default)
180 291W 160 BPM Threshold
200 325W 171 BPM VO2 Max
254 400W 200 BPM Sprint (max)

Run Custom Workout

# Via Python script
python test_automation.py --custom my_workout.json

# Validate first
python test_automation.py --custom my_workout.json --dry-run

๐ŸŽฎ Zwift Integration Testing

Setup for Zwift Testing

  1. Start Sensor
    python test_automation.py --workout warmup
  2. Open Zwift and go to Settings โ†’ Sensors
  3. Pair Sensors:
    • Heart Rate: "Bike Sensor Matter"
    • Power Meter: "Bike Sensor Matter"
  4. Start Riding in Zwift
  5. Run Test Workout
    python test_automation.py --workout intervals

Validation Checklist

๐Ÿ“Š Performance Testing

Metrics to Track

Metric Target Critical How to Measure
Connection Time <5s <10s Time from power-on to Zwift pairing
Update Rate 1 Hz >0.5 Hz BLE notification frequency
Transition Time <2s <5s Time to reach new intensity
Value Accuracy ยฑ5% ยฑ10% Actual vs expected power/HR
Stability (1hr) >99% >95% Success rate over time

Running Performance Tests

# Test sustained load
python test_automation.py --workout endurance

# Test rapid changes
python test_automation.py --workout tabata

# Test all scenarios
python test_automation.py --all

๐Ÿ› Troubleshooting

Common Issues

Issue Cause Solution
Zwift doesn't see values changing Sensor not enabled Turn on sensor in iOS app
Python script fails chip-tool not found Install Matter SDK and chip-tool
Command timeout Wrong node-id or device offline Verify node-id, check device power
Inconsistent results Network interference Check Thread network stability
Segments don't transition High Matter latency Move closer to border router

Next Steps

Ready to go deeper? Check out: