<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>AppTest on 每日拍拍</title>
    <link>https://dailypypy.org/tags/apptest/</link>
    <description>Recent content in AppTest on 每日拍拍</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh-tw</language>
    <copyright>© 2026 每日拍拍</copyright>
    <lastBuildDate>Mon, 24 Aug 2026 11:09:00 +0800</lastBuildDate><atom:link href="https://dailypypy.org/tags/apptest/index.xml" rel="self" type="application/rss+xml" />
    <follow_challenge>
      <feedId>155076163427069952</feedId>
      <userId>154825760438254592</userId>
    </follow_challenge>
    
    
    <item>
      <title>Streamlit AppTest 實戰：用 pytest 測 Widgets、Session State 與 CI</title>
      <link>https://dailypypy.org/learn/streamlit-apptest-pytest/</link>
      <pubDate>Mon, 24 Aug 2026 11:09:00 +0800</pubDate>
      
      <guid>https://dailypypy.org/learn/streamlit-apptest-pytest/</guid>
      <description>&lt;!---
1440x768
prompt: masterpiece, best quality, highres, clean anime illustration, japanese anime style, soft shading, flat color design, 1girl, black hair, green eyes, white off-shoulder shirt, black short skirt, from below low angle, upper body, pointing upward with one hand while explaining, determined confident smile, looking at viewer, light mint background, subtle floating translucent interface tiles and connected green indicator dots without symbols or text, neat composition, detailed eyes, cute and smart vibe, minimal background, polished illustration, no text
negative prompt: worst quality, bad eye, bad hand, extra limbs, manga, multiple views, monochrome, text, signature
dedup note: This is a testing-specific follow-up to ../python-streamlit/ and ../python-streamlit-advanced/. Those articles cover building widgets, dashboards, Session State, cache, and multipage structure; this article focuses on Streamlit AppTest, simulated widget interaction, rendered-output and Session State assertions, test-only secrets, exception checks, pytest organization, and CI. It also differs from ../python-pytest/ and ../python-pytest-fixtures/, which teach general pytest patterns rather than testing Streamlit&#39;s rerun model.
---&gt;
&lt;p&gt;Streamlit 很適合快速把資料流程包成小工具，但「瀏覽器點起來沒問題」不是測試。
Widget 一多、Session State 一複雜，改一行 callback 就可能讓另一條操作路徑悄悄壞掉。
好消息是，Streamlit 內建的 &lt;code&gt;AppTest&lt;/code&gt; 不需要真的啟動瀏覽器。
它能在 Python 測試裡執行 App、操作 Widget、觸發 rerun，再讓 pytest 檢查畫面與狀態。&lt;/p&gt;</description>
      <media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://dailypypy.org/learn/streamlit-apptest-pytest/featured.png" />
    </item>
    
  </channel>
</rss>
