[英]What would be a proper way of integration testing JavaScript interacting with local storage?
聽完JavaScript Weekly播客之后,我聽說了jQueryLocalStorageTexteareas插件,然后決定自己嘗試實現此功能。
它的基本作用是將文本區域的內容保存到瀏覽器的本地存儲(如果瀏覽器支持)。
我的問題是,我將如何以TDD風格編寫此內容? 最高級別的測試實現會是什么樣子? 可能應該是這樣的
when I type foo in a text area
and I close the page
and I open it again
then the text area should contain foo
是否值得使用Selenium之類的東西來進行這類測試? 還是有更好的方法呢?
使用為該作業構建的測試框架,例如qUnit。 jQuery-offline很好地使用了它,可以在支持和不支持本機的瀏覽器中使用localStorage
測試文本緩存。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.