Every data app builder wants to build a flawless app in record time, but speed and quality may feel at odds with each other. Imagine pouring your heart into coding a beautiful new Python app, eager to share it with the world. However, before you can deploy, you can’t rush testing, else you’ll risk a code error tarnishing your app experience.
We've heard your pain and felt this ourselves. In practice, you probably do some manual sanity tests of your app changes and hope for the best. Yesterday’s automated test options are usually complex and hard to maintain:
- Conduct unit tests on the backend logic by factoring it out from the UI
- Set up a heavyweight browser testing framework like Selenium, Playwright, or Cypress for end-to-end testing
Luckily, you don’t have to live in this reality anymore. You can develop faster and ensure high quality!
AppTest is a new automated way to write and execute tests natively in Streamlit. Developers can use this API to confirm that all aspects of their app are working correctly.
With this automated testing framework you can:
Code with confidence: Run all your tests with a single command with Pytest. You no longer need to factor out your unit testable code or do extensive manual testing. Dealing with heavy end-to-end testing frameworks can be a thing of the past.
Collaborate seamlessly: Build apps with your team without worrying about breaking existing workflows. By connecting Streamlit to tools like GitHub Actions you can build a continuous integration pipeline that automatically runs tests after each commit.
Feel more comfortable with complexity. Go beyond prototypes and build more powerful apps to take your data apps to the next level.
Simple, powerful, and all in Python. 💪
How AppTest works
Now you can test each feature, interaction, or app logic headlessly via API. By headlessly, we mean that you can test the result without having to preview in the browser. You can use the API reference docs to build out different scenarios you want to test.
When you are ready, test everything with Pytest, locally and/or with GitHub Actions. View the results that will confirm that your features are all working correctly (or not).
AppTest in action
Watch the video to take a tour of AppTest. In the demo video will cover:
Ready, set, test!
Start building and executing tests faster with AppTest to have more control over your app experiences. Check out the docs to get started.
Show off what you have built!
Share a link to tests you built for your Community Cloud app and show them successfully running in GitHub Actions.
You can share an example by posting a link to your test file like this, and then share a successful run in a link like this. To get started setting up GitHub Actions, take a look at GitHub’s tutorial or use our sample workflow file.
If you provide your email in the comment with the two links, we will send the first 10 examples a Streamlit t-shirt!
Happy Streamlit-ing 🎈
This is a companion discussion topic for the original entry at https://blog.streamlit.io/apptest-faster-automated-testing