We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
单元测试前端逻辑非常困难,因为有很多部分组成,例如前端的服务器端代码更改和客户端更改都会影响应用程序的显示方式。
在 Google 测试博客上,他们讨论了测试 MVP 所有部分的价值以及通过删除昂贵部分来测试 AJAX 的价值 此处。 Misko Hevery 此处谈论了不同的测试,我觉得前端测试属于他的大测试类别,因此总是有误报/误报的机会,但需要对它们进行排序,因为它们仍然提供很多价值
前端测试非常有价值,因为它们检查用户功能是否没有下降离开。 这就是为什么像 Selenium 和 Watir 非常受欢迎。
Unit testing front end logic is extremely hard since there are many parts that make it up like server side code changes to the front end and client side changes can all affect how the application appears.
On the Google testing blog they talked about the value of testing all the parts of a MVP and the value of testing AJAX by stubbing the expensive parts here. Misko Hevery talks about the different tests here and I feel that the Front End tests fall into his large test category so always have the chance of false negatives/positives but they need to be sorted because they still offer a lot of value
Front end tests are extremely valuable as they check the user functionality hasn't dropped off. This is why tools like Selenium and Watir are so popular.
修复破损的窗户。
这是理论的链接 http://en.wikipedia.org/wiki/Fishing_Broken_Windows
防止代码质量不佳的一个成功策略是始终保持代码库干净并处于良好状态。 这意味着清理所有错误代码。 这可能会很痛苦,而且很耗时,但无论如何你都需要这样做。
当我们删除了项目中的所有编译警告后,我们发现我们的代码质量得到了提高。 人们开始关心他们签入的内容,因为我们发出了一个信号,即签入错误代码是不行的(即使是警告也是不行的),并且没有人想成为第一个打破窗口的人。
Fix the broken window.
here is a link to the theory http://en.wikipedia.org/wiki/Fixing_Broken_Windows
A successful strategy for preventing poor code quality is to always keep your code base clean and in prestige condition. This means clean up all the bad code. It might be painful, and time consuming, but you will need to do it anyway.
After we removed all the compile warnings on our project, we found that our code quality has been improving. People start to care what they check in, since we send out a signal that it is not ok to checkin bad code(even warning is not ok), and no one wants to be the first one to break the window.
测试 UI 时的另一个陷阱是,最终很容易编写测试框架而不是应用程序的测试。 或者反过来说:编写实际测试 UI 而不是 UI 框架的测试可能具有挑战性。
例如,一些团队最终编写了大量无用的测试,例如:
Another pitfall when testing UI is that it is especially easy to end up writing tests that test the framework and not your application. Or said in reverse: it can be challenging to write test that actually test your UI and not the UI framework.
For instance, some teams end up writing lots of useless tests like:
对我来说,问题是在维护测试的成本和发现否则无法发现的错误的可能性之间进行权衡。 想必您仍然会对实际 UI 进行一些视觉测试(否则您会很好地测试美观性)。
例如,您能否只关注 Presenter 的某些方面? 例如,一个不平凡的格式化程序,用许多有趣的值来练习它。
我怀疑说服的一种方法是慢慢进行。 首先尝试寻找省力的测试。
The question for me would be the trade-off between the costs of maintaining the tests and the probability of catching bugs that would not be caught otherwise. Presumably you will still have some visual testing of the actual UI (you'll do really well to test the aesthetics otherwise).
Can you for example focus only on some aspects of the Presenter. For example a non-trivial formatter, exercise that with lots of interesting values.
I suspect that one way to persuade is to proceed slowly. Try to find low-effort tests initially.