Online course · Engineering

Embedded Testing and Hardware-in-the-Loop CI: Unit Tests to Automated Board Rigs

Test firmware on the host, then flash, power and check real boards from CI

Created by TrainSkool Trainer

Embedded Testing and Hardware-in-the-Loop CI: Unit Tests to Automated Board Rigs course cover

Coming soon Launch price ₹1,999

This course is not open for enrolment yet.

About this course

For embedded engineers who already write C for microcontrollers and want their firmware tested automatically, from unit tests on a laptop to real boards flashed and checked by a CI pipeline. You follow one running example, Kaveri Embedded Labs, a fictional Coimbatore company shipping a farm motor-pump controller and a cold-chain logger. You will unit-test C on the host, fake registers, time and I2C devices, gate builds with warnings, house rules and size, stack and timing budgets, design a test-friendly serial log, capture and match board output in Python, flash Raspberry Pi Pico 2 and ESP32-C3 boards from scripts (picotool, esptool, OpenOCD, STM32CubeProgrammer CLI), power-cycle boards through a relay or switchable USB hub, write JUnit reports, detect flaky tests, and run it all from a self-hosted CI runner. The capstone is an automated rig for two boards. You need a Pico 2 or Pico 2 W, an ESP32-C3 board and a few low-cost, low-voltage parts. Prerequisite: Embedded C on ARM and RISC-V, or solid C. Included: 26 text lessons with slides and quick checks, 25 auto-checked C and Python exercises, 7 chapter projects, chapter quizzes, a rubric-graded capstone, a 20-question final exam and a certificate of completion. Lessons are text and slides; trainer videos are coming later. Not affiliated with or endorsed by Raspberry Pi Ltd, Espressif, STMicroelectronics, Arm or GitHub. What you will be able to do: - You will be able to design firmware with a HAL seam and unit-test its logic in C on a laptop with gcc. - You will be able to write fakes, stubs, spies and mocks for registers, HAL calls, time and I2C devices. - You will be able to gate builds with strict warnings, house rules and size, stack and timing budgets. - You will be able to design a KV1-style serial log and capture, parse and match board output in Python. - You will be able to flash and power-cycle Pico 2 and ESP32-C3 boards from scripts and recover hung boards. - You will be able to build a rig runner that reports PASS, FAIL or ERROR in JUnit XML and detects flaky tests. - You will be able to run hardware-in-the-loop tests from a CI pipeline with a secured self-hosted runner. - You will be able to deliver a documented, automated test rig for two boards with nightly soaks and health checks.

What you'll learn

  • You follow one running example, Kaveri Embedded Labs, a fictional Coimbatore company shipping a farm motor-pump controller and a cold-chain logger.
  • You will unit-test C on the host, fake registers, time and I2C devices, gate builds with warnings, house rules and size, stack and timing budgets, design a test-friendly serial log, capture and match board output in Python, flash Raspberry Pi Pico 2 and ESP32-C3 boards from scripts (picotool, esptool, OpenOCD, STM32CubeProgrammer CLI), power-cycle boards through a relay or switchable USB hub, write JUnit reports, detect flaky tests, and run it all from a self-hosted CI runner.
  • The capstone is an automated rig for two boards.
  • You need a Pico 2 or Pico 2 W, an ESP32-C3 board and a few low-cost, low-voltage parts.
  • Prerequisite: Embedded C on ARM and RISC-V, or solid C.
  • Included: 26 text lessons with slides and quick checks, 25 auto-checked C and Python exercises, 7 chapter projects, chapter quizzes, a rubric-graded capstone, a 20-question final exam and a certificate of completion.
  • Lessons are text and slides; trainer videos are coming later.
  • Not affiliated with or endorsed by Raspberry Pi Ltd, Espressif, STMicroelectronics, Arm or GitHub.

Course content

Chapter 1 · Module 1: Why Test Embedded Software

  • Code lab: What Breaks in Embedded Products and the Test PyramidKaveri Embedded Labs in Coimbatore (a fictional company we follow through this course) ships KaveriPump, a controller that switches a farm motor-pump on when the soil in a coconut or banana plot…16 topics · 30 min
  • Code lab: Designing Firmware for Testability: The HAL SeamYou cannot unit-test code that calls gpio_put() and adc_read() directly on a laptop: those functions, and the registers behind them, do not exist there.17 topics · 35 min
  • Code lab: Tour of a Hardware-in-the-Loop Rig: Flash, Capture, Compare, Power-CycleHost tests prove the logic. They cannot prove that the firmware boots on a real ESP32-C3, that the right pin moves, or that a new compiler flag has not broken start-up.22 topics · 35 min

Chapter 2 · Module 2: Unit Testing C on the Host

  • Code lab: A Minimal C Test Runner from ScratchKaveri's firmware lead Arjun has a rule for the team: before you pick a test framework, write one yourself, once.16 topics · 30 min
  • Code lab: Unity-Style Frameworks, Fixtures and a CMake/CTest Build1 is enough to learn from, but Kaveri's test suite will grow to hundreds of tests across a dozen modules, written by four people, run by CI on every commit.18 topics · 35 min
  • Code lab: Table-Driven Tests for Fixed-Point, Ring Buffers and State Machines7 days. Most field bugs sit on one of those edges.16 topics · 35 min
  • Code lab: Coverage and Sanitizers: gcov, ASan and UBSan on the HostMeena's seven state-machine tests all pass. Does that mean the state machine is tested?22 topics · 35 min

Chapter 3 · Module 3: Test Doubles for Registers and HAL

  • Code lab: Faking Memory-Mapped RegistersThe HAL seam from Module 1 keeps application logic away from hardware.16 topics · 35 min
  • Code lab: Stubs, Spies and Mocks for the HALIn Module 1 Kaveri's fake HAL was a handful of global variables. That was enough to show the seam.15 topics · 35 min
  • Code lab: Faking Time and Devices: Ticks, Debouncers and a Fake I2C SensorTwo things make embedded code hard to test even after the HAL seam: time and other chips.21 topics · 40 min

Chapter 4 · Module 4: Static Analysis, Coding Rules and Budgets

  • Code lab: Compiler Warnings as Your First TestThe cheapest test Kaveri runs is one nobody writes: the compiler's warnings.16 topics · 30 min
  • Code lab: Static Analysers and MISRA-Style RulesCompiler warnings look at one file at a time and only at patterns the compiler team chose.17 topics · 35 min
  • Code lab: Size, Stack and Timing Budgets as TestsA KaveriPump firmware release can pass every unit test and still be a failure: it no longer fits in the flash of the cheaper board variant, it uses so much RAM that the stack runs into the data, or…23 topics · 35 min

Chapter 5 · Module 5: Serial-Protocol Test Harnesses

  • Code lab: Designing a Test-Friendly Serial LogEvery board-level test in this course ends with the rig reading lines from a serial port and deciding pass or fail.18 topics · 30 min
  • Code lab: Capturing Serial Output with Python: Ports, Timeouts and ResetsMeena's first automated capture script for the Kaveri rig was four lines long: open the port, read for ten seconds, save, close.18 topics · 35 min
  • Code lab: Matching Expected Output and Testing a Command Protocol with CRCReal board output is never quite the same twice. 3 might read -1843 if the rig later uses a real sensor; version numbers change every release.23 topics · 40 min

Chapter 6 · Module 6: Hardware-in-the-Loop: Flashing, Power and Verdicts

  • Code lab: Flashing from Scripts: picotool, esptool, OpenOCD and STM32CubeProgrammer CLIpy flash and wait. On the Kaveri rig nobody is there to press buttons.16 topics · 35 min
  • Code lab: Power-Cycling and Reset: Relays, Switchable USB Hubs and Reset LinesSooner or later a board on the rig stops answering. A test firmware hangs in a tight loop, the USB stack wedges, the ESP32-C3 sits in its ROM bootloader after a bad flash.17 topics · 35 min
  • Code lab: The Rig Runner: Flash, Reset, Capture, Match, JUnit Report3.18 topics · 40 min
  • Code lab: Flaky Tests on Real Hardware: Detect, Retry, QuarantineThree weeks after the Kaveri rig went live, Farhan noticed a pattern in the CI history: the ESP32-C3 temperature test failed about once in fifteen runs, on commits that did not touch anything near it.24 topics · 35 min

Chapter 7 · Module 7: CI Pipelines with a Self-Hosted Runner

  • Code lab: Firmware CI: Build Matrix, Toolchain Containers and ArtifactsEverything Kaveri has built so far runs when someone remembers to run it.19 topics · 35 min
  • Code lab: A Self-Hosted Runner for the Rig: Labels, Locks and SecurityHosted CI machines live in a data centre; they cannot reach the Pico 2 and the ESP32-C3 on Kaveri's bench in Coimbatore.17 topics · 35 min
  • Code lab: Reports, Gates, Nightly Runs and Rig HealthA pipeline that runs but that nobody trusts or reads is worse than none: it costs time and gives false comfort.23 topics · 35 min

Chapter 8 · Module 8: Capstone: An Automated Rig for Two Boards

  • Code lab: Capstone Brief and Rig ArchitectureEvery module so far built one piece of Kaveri's test system and proved it in isolation: host tests, test doubles, static gates, serial harnesses, flashing, power control, the runner, the pipeline.16 topics · 45 min
  • Code lab: Build Guide: From First Flash to Green PipelineRigs fail in their integration, not in their parts. Every module in this course worked alone on a laptop or a single board.13 topics · 60 min
  • Code lab: Deliverables, Demonstration and Grading RubricA rig is only finished when someone else can trust it, run it and repair it.15 topics · 45 min

Assessments and certificate

  • Module 1 quiz: Why Test Embedded Software7 questions · 15 min · pass mark 70%
  • Module 2 quiz: Unit Testing C on the Host7 questions · 15 min · pass mark 70%
  • Module 3 quiz: Test Doubles for Registers and HAL7 questions · 15 min · pass mark 70%
  • Module 4 quiz: Static Analysis, Coding Rules and Budgets7 questions · 15 min · pass mark 70%
  • Module 5 quiz: Serial-Protocol Test Harnesses7 questions · 15 min · pass mark 70%
  • Module 6 quiz: Hardware-in-the-Loop: Flashing, Power and Verdicts7 questions · 15 min · pass mark 70%
  • Module 7 quiz: CI Pipelines with a Self-Hosted Runner7 questions · 15 min · pass mark 70%
  • Embedded Testing and Hardware-in-the-Loop CI: Unit Tests to Automated Board Rigs — final assessment20 questions · 40 min · pass mark 70%

Related courses

Frequently asked questions

Can I get a refund for Embedded Testing and Hardware-in-the-Loop CI: Unit Tests to Automated Board Rigs?

Yes. You can request a full refund within 7 days of purchase, provided you have completed no more than 25% of the lessons, not started the final exam and not been issued a certificate. Pre-orders of a course that has not launched yet can be refunded in full any time before launch. Email refunds@trainskool.com with your order reference; approved refunds go back to your original payment method.

How long do I have access to the course?

Lifetime access. A one-time payment of ₹1,999 keeps the course in your TrainSkool learning dashboard, on the web and in the TrainSkool apps, with no subscription to cancel.

Do I get a certificate?

Yes. TrainSkool issues a certificate when you meet the course requirements, including passing its 8 graded assessments. Every certificate has a public verification link that employers can check.

Are there any prerequisites?

No other course is required. The course level is advanced, so check the curriculum to confirm it matches your experience.

How is the course delivered?

Online and self-paced: 8 modules and 26 lessons, about 15h 50m of study, with graded assessments. Learn in your browser or the TrainSkool Android and Windows apps.