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

Fully automate our tests #64

Closed
suntong opened this issue Aug 3, 2021 · 1 comment
Closed

Fully automate our tests #64

suntong opened this issue Aug 3, 2021 · 1 comment

Comments

@suntong
Copy link
Contributor

suntong commented Aug 3, 2021

Last time I did a test under openwechat using

go test ./...

It just hang there doing nothing. Then I realized that the first step is to login into WX, and the test waits there for me to do it.

I'm thinking that doing fully automated tests with a mock WX server should not be that difficult. Here are the things that I find that might be useful for it:

Mocking HTTP Requests in Golang
https://www.thegreatcodeadventure.com/mocking-http-requests-in-golang/

Testing Your (HTTP) Handlers in Go
https://blog.questionable.services/article/testing-http-handlers-go/

The awesomeness of the httptest package in Go
https://gianarb.it/blog/golang-mockmania-httptest

@suntong
Copy link
Contributor Author

suntong commented Aug 3, 2021

我现在目前的想法是
mock时,换连自己的服务器
当时要取消XmlFormString时我想的是,取消很容易,但验证不出错,就比较有难度
有这么一个仿真服务器的话,就会好得多
取消前取消后个自测一遍,效果一样就完事儿了✌️

虽然XmlFromString现已经解决了
但是这个仿真服务器,我想还是会有用处的
XmlFormString只不过是现在我能看到的一个例子

现在的任何程序对于微信来讲,都还是客户端
我想的是对任何客户端都可以连进去的仿真微信
这个仿真微信可以收发消息
这样我们测试对消息的处理的时候就很有用

我自己编一个很容易呀
因为我想收发信息的话,不难
第一步,如果能做到收发文本信息的话,我想有那个几分钟个把小时肯定搞定了

这个仿真服务器主要是用来测试
客户端商务逻辑的(Business logic)
我收到这种信息,该怎么处理?收到那样的,又该怎么办?有一套自动的测试系统的话就很方便

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

2 participants