tvst / st-annotated-text

A simple component to display annotated text in Streamlit apps.
Apache License 2.0
498 stars 39 forks source link

Write Tests #15

Open sugatoray opened 2 years ago

sugatoray commented 2 years ago

Writing tests for a Streamlit app/component could be challenging. Here is a framework, presented by Randy Zwitch (@randyzwitch), on the Streamlit blog:

Streamlit test framework with SeleniumBase & OpenCV

I hope this will start the discussion on writing test cases for this Streamlit component and encourage people to come forward and write tests.

Example repo: https://github.com/randyzwitch/streamlit-folium

tvst commented 2 years ago

Actually Streamlit isn't making testing any harder here.

In terms of unit tests, we really just need to test the function called get_annotated_html. This should be quite simple, but the cost/benefit ratio is quite high given this is such a simple component anyway.

The other thing that would be useful is screenshot tests. But these are fairly complex to set up (I would know! I worked a lot on them in github.com/streamlit/streamlit!), so cost/benefit would be even higher.