这不一定是 rust 特有的问题,不过 cargo 测试太方便了,所以我很想继续用它……
我在把一个经过充分测试的桌面应用转成 WASM 应用。把 IO 移到调用链更上层之后,需要修改的代码很少,所以组成 WASM 应用的代码库仍然是经过充分测试的。
不过完整的“应用”还有其他部分,包括一些 html 和不少 JS。我想把这些全都测到,最好能覆盖多个浏览器,但不知道从哪里开始,尤其不知道怎么接到 cargo test 里。大概得先启动一个网页服务器……然后呢?需要填写 html 表单、点击提交按钮,之后可能还得批准下载,再检查下载内容是否正确。
有人能指点一下该从哪里找起吗。先谢谢了!
从英语翻译·查看原文This isn't necessarily specific to rust, although cargo makes testing convenient enough that I'd quite like to stick with it...
I'm taking a thoroughly tested desktop application and turning it into a wasm application. Once IO was moved higher in the call chain, very little code needed changing, so the library containing the code that makes up the wasm application remains thoroughly tested as a result.
The complete "app", though, includes additional pieces, with some html and a fair amount of JS. I'd like tests covering all of that (ideally across multiple browsers), but don't know where to start (especially with hooking it into cargo test). Presumably a web server has to be started... what comes next? A html form needs input, its submit button needs clicking, and a resulting download probably needs approving before its contents can be verified.
Could somebody suggest where I should start looking. Thanks beforehand!