How to get test GCM tokens?

纵饮孤独 提交于 2020-01-06 15:49:49

问题


We have implemented a gateway service and push manager services to send push messages to GCM. Now we want to do some automated testing.

How we can test GCM tokens?

We can get some tokens from real devices and after sometime they might expire and tests will fail. To test positive and negative scenarios we need known valid and invalid GCM tokens.

Any help guys?

Thanks.


回答1:


Okay, so I may have misunderstood the question, thinking that you were asking how to test registration tokens.

If by test GCM tokens you mean the registration tokens, it is commonly generated upon app installation. With that said, you don't only receive them when using devices, you can also get one when using an emulator (I for one use it all the time for testing).

For valid, this one is pretty simple. First token you het upon installation should be good.

For invalid tokens, I think anything that isn't a token (random string and stuff) will be treated as invalid. One thing though is expired tokens, wherein you have to force call the onTokenRefresh() to generate a new one, making the old one expired.



来源:https://stackoverflow.com/questions/40168593/how-to-get-test-gcm-tokens

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!