解决难以重现的错误
在我正在开发的一个js应用程序中,对于一些正在测试它的用户来说,时不时会出现一些错误,但我自己无法重新创建它们。
有哪些工具/方法可以调试难以重新创建的错误,或者似乎只发生在开发人员无法访问的计算机上的错误?
In a js app I'm developing there are a few bugs that recur every now and then for some users who are testing it, but I've been unable to recreate them myself.
What tools/approaches are there to debug bugs which are difficult to recreate, or which only seem to happen on a computer the developer doesn't have access to?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我做的第一件事就是获取看到该错误的人的用户代理,这样我就可以检查它并确保我在完全相同的浏览器版本和操作系统上进行测试。他们可以通过访问 http://whatsmyuseragent.com/ 查看他们的用户代理,
如果可能的话,我还要求进行截屏视频--有时我认为我正在执行与他们完全相同的步骤,但实际上我误解了他们的意思。
对于非常棘手的错误,我尝试在代码中添加一些日志记录(也许添加一个日志记录窗口),以便我可以找出它们命中的代码路径。
The very first thing I do is get the user agent of the person who saw the bug, so I can check it and make sure I'm testing on the exact same browser version and operating system. They can see their user agent by going to http://whatsmyuseragent.com/
I also ask for a screencast if possible--sometimes I think I'm doing the exact same steps they are, but actually I misunderstood what they meant.
For really tough bugs, I try to add some logging into the code (maybe add a logging window) so I can figure out which codepaths they hit.
我建议创建一些单元测试: https://github.com/pivotal/jsunit
我不会'在此不必详述创建强大的单元测试套件的优缺点,但即使是最基本的单元测试也应该有助于提高系统的整体质量,并允许您更快更好地定位/防止错误。
I would recommend creating some unit tests: https://github.com/pivotal/jsunit
I won't belabor the pros and cons of creating a robust unit testing suite here, but even the most basic unit tests should help improve the overall quality of your system and allow you to locate/prevent bugs faster and better.