Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

只能用于组件单元测试吗? #79

Closed
hubingg opened this issue Aug 8, 2021 · 3 comments
Closed

只能用于组件单元测试吗? #79

hubingg opened this issue Aug 8, 2021 · 3 comments

Comments

@hubingg
Copy link

hubingg commented Aug 8, 2021

加载页面page是否可以呢

@JuneAndGreen
Copy link
Contributor

页面可尝试走 Component 构造器创建,应该也能测,但是生命周期可能不够完善。因为自定义组件本身粒度较细,所以才比较适合抽离出来做单元测试。

你想测试页面的话,也可以尝试一下开发者工具提供的自动化能力:https://developers.weixin.qq.com/miniprogram/dev/devtools/auto/ ,这个可以利用真正的小程序环境做完整的功能自动化测试。

@qidaneix
Copy link

如果想利用此项目改写成page的simulate,有没有什么需要注意的点呢?

@JuneAndGreen
Copy link
Contributor

如果想利用此项目改写成page的simulate,有没有什么需要注意的点呢?

如上面所提到的,page 必须走 component 构造器,一些 page 实例上独有的方法和生命周期则需要自己 mock。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants