<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mustafa Uçar</title>
    <description>The latest articles on DEV Community by Mustafa Uçar (@flyz).</description>
    <link>https://dev.to/flyz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4279374%2F4e4b0726-4694-4bd3-b587-342cd8a871f2.png</url>
      <title>DEV Community: Mustafa Uçar</title>
      <link>https://dev.to/flyz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/flyz"/>
    <language>en</language>
    <item>
      <title>Testing IoT failure and recovery without a physical device or a 31-second sleep</title>
      <dc:creator>Mustafa Uçar</dc:creator>
      <pubDate>Thu, 03 Dec 2026 00:04:18 +0000</pubDate>
      <link>https://dev.to/flyz/testing-iot-failure-and-recovery-without-a-physical-device-or-a-31-second-sleep-1nfm</link>
      <guid>https://dev.to/flyz/testing-iot-failure-and-recovery-without-a-physical-device-or-a-31-second-sleep-1nfm</guid>
      <description>&lt;p&gt;When maintaining an IoT integration, testing a normal API response is only part of the job. What happens when the device becomes unavailable, returns an HTTP 503, or recovers with a different value?&lt;/p&gt;

&lt;p&gt;I'm building &lt;a href="https://github.com/FlyzDev/fixturekit" rel="noopener noreferrer"&gt;FixtureKit&lt;/a&gt;, an experimental open-source Python toolkit (Apache-2.0) for reviewed test fixtures and repeatable regression scenarios. Here is a small example you can run without a device or Home Assistant.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Get the synthetic scenario
&lt;/h2&gt;

&lt;p&gt;Download &lt;a href="https://flyzdev.github.io/fixturekit/downloads/fixturekit-scenario-preview-p2.zip" rel="noopener noreferrer"&gt;Scenario Preview P2&lt;/a&gt; and its &lt;a href="https://flyzdev.github.io/fixturekit/downloads/fixturekit-scenario-preview-p2.zip.sha256" rel="noopener noreferrer"&gt;SHA-256 checksum&lt;/a&gt;. Verify the ZIP before extracting it to a new directory. On macOS/Linux, from the download directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;shasum -a 256 -c fixturekit-scenario-preview-p2.zip.sha256
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the extracted directory, create a Python 3.12 environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3.12 -m venv .venv
.venv/bin/python -m pip install --require-hashes --only-binary=:all: -r examples/scenario/requirements-offline.txt
.venv/bin/python -m examples.scenario.offline_regression --manifest examples/scenario/climate-timed.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Windows commands, see the &lt;a href="https://github.com/FlyzDev/fixturekit/blob/main/QUICKSTART.md#try-a-virtual-time-scenario-without-cloning" rel="noopener noreferrer"&gt;quickstart&lt;/a&gt;. Installation needs package access; the scenario execution is offline.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Test the recovery sequence
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Virtual time&lt;/th&gt;
&lt;th&gt;Response&lt;/th&gt;
&lt;th&gt;Expected state&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0 ms&lt;/td&gt;
&lt;td&gt;HTTP 200&lt;/td&gt;
&lt;td&gt;Available, 19°C&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1,000 ms&lt;/td&gt;
&lt;td&gt;HTTP 503&lt;/td&gt;
&lt;td&gt;Unavailable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;30,000 ms&lt;/td&gt;
&lt;td&gt;HTTP 503&lt;/td&gt;
&lt;td&gt;Unavailable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;31,000 ms&lt;/td&gt;
&lt;td&gt;HTTP 200&lt;/td&gt;
&lt;td&gt;Available, 23°C&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The bundled example returns four observations, &lt;code&gt;status: pass&lt;/code&gt; and &lt;code&gt;virtual_elapsed_ms: 31000&lt;/code&gt;. That is elapsed virtual time, not a benchmark or a real 31-second wait. The replay uses an ordered in-memory session double, not a live device simulator.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Make the regression fail on purpose
&lt;/h2&gt;

&lt;p&gt;Copy &lt;code&gt;examples/scenario/climate-timed.json&lt;/code&gt; to a new file. Change only the last &lt;code&gt;expected.temperature&lt;/code&gt; from &lt;code&gt;23&lt;/code&gt; to &lt;code&gt;24&lt;/code&gt; and run the same command against the copy. The result should be &lt;code&gt;status: fail&lt;/code&gt;, one &lt;code&gt;values_changed&lt;/code&gt; difference and exit code 1. An invalid manifest instead exits with code 2.&lt;/p&gt;

&lt;p&gt;Keeping responses separate from expectations helps detect a regression instead of automatically accepting whatever the implementation returns.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Inspect the workflow
&lt;/h2&gt;

&lt;p&gt;The optional Tk scenario editor lets you edit the same synthetic steps and run the checks locally. The browser-based Studio demo shows recorded first-party test reports:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw7u4mm2wzj7ey83l2klj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw7u4mm2wzj7ey83l2klj.png" alt="FixtureKit Studio comparison of synthetic reports" width="800" height="625"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://flyzdev.github.io/fixturekit/" rel="noopener noreferrer"&gt;Explore the live demo and downloads&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I want to learn next
&lt;/h2&gt;

&lt;p&gt;FixtureKit also has a separately published Core alpha with explicit JSON projection, heuristic JSON/XML/HAR audits and pytest/pre-commit integration. It is intended to complement existing test tools and redactors, not replace them. A clean audit is not a privacy guarantee. Use reviewed synthetic fixtures and keep real device identifiers and credentials out of shared examples.&lt;/p&gt;

&lt;p&gt;I'm looking for feedback from maintainers of Python device API libraries and Home Assistant integrations: what format are your current fixtures in, and would an incremental migration path help? Would step-level failure diagnostics make this workflow more useful?&lt;/p&gt;

&lt;p&gt;Repository: &lt;a href="https://github.com/FlyzDev/fixturekit" rel="noopener noreferrer"&gt;https://github.com/FlyzDev/fixturekit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Disclosure: FixtureKit and this article were developed with extensive AI assistance. The project is in alpha; independent security and usability reviews are pending.&lt;/p&gt;

</description>
      <category>iot</category>
      <category>opensource</category>
      <category>python</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
