11 Testing Streamlit apps
This chapter covers
- Developing a testing strategy for an application
- Differences between progress unit, integration, and end-to-end tests
- Writing and running automated tests using pytest
- Using Streamlit's AppTest to create a running app with simulated user interactions
- Evolving your tests alongside your code
You've spent hours building your Streamlit app. The UI looks great, the code runs smoothly, and you're ready to share it with the world. But what happens when a user suddenly enters unexpected data? Or when the API you're calling changes its response format? Or when you deploy an update that inadvertently breaks existing functionality?
Without proper testing, your elegant application can quickly transform into a frustrating experience for your users. As the saying goes, "Untested code is broken code"—a sentiment that applies as much to Streamlit apps as to any other piece of software.