【发布时间】:2015-06-11 06:17:35
【问题描述】:
这似乎是一个愚蠢的问题,但我发现自己经常遇到这个问题。
我想编写一个简单的应用程序来监视键盘上的类型以及我使用鼠标的时间,以便我可以监视计算机的使用情况和工作效率。
考虑以下小黄瓜功能:
Feature: MouseInteractionMonitoring
In order to know when the user is at the computer
As an interaction monitor
I want to be able to be able to monitor when the user moves the mouse
在我看来,这似乎无法测试。
那我该怎么办?
我是否应该使用抽象层来解决这个问题,方法是编写一个单独的组件来监视鼠标移动,然后将该报告报告给用户交互模块并模拟鼠标移动组件?
如何处理上述不可测试的代码?
非常感谢您对此提供的任何建议。
【问题讨论】: