减少编写集成和系统测试的痛苦
我想为我的应用程序进行集成测试和系统测试,但是进行良好的集成和系统测试通常需要付出很多努力,所以我没有费心。我尝试了几次,编写了自定义的、特定于应用程序的测试工具,每次都感觉像是重新发明轮子。我想知道这是否是错误的做法。是否有集成和完整系统测试的“标准”方法?
编辑:澄清一下,它是针对桌面和 Web 应用程序的自动化测试。理想情况下,一个完整的测试套件可以测试应用程序的全部功能。
I would like to make integration tests and system tests for my applications but producing good integration and system tests have often needed so much effort that I have not bothered. The few times I tried, I wrote custom, application-specific test harnesses, which felt like re-inventing the wheel each time. I wonder if this is the wrong approach. Is there a "standard" approach to integration and full system testing?
EDIT: To clarify, it's automated tests, for desktop and web applications. Ideally a complete test suite that exercises the full functionality of the application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果“进行集成测试和系统测试”是指自动化测试,那么答案是否定的,没有标准方法。选择什么方法取决于:
就我个人而言,我喜欢任何与 JUnit 集成的方法。 JUnit 是一个非常棒的框架,它得到了很好的支持,并且可以轻松地绑定到连续集成服务器中。以下是一些可能的方法:
上述示例提供了大量的用于测试的框帮助。当然,它们仍然需要努力连接到您的应用程序并进行维护,但其优点是非常值得的。除了上述内容之外,您可能还需要考虑如何存根或模拟应用程序的区域。也许您想在“GUI 下”或“数据库之上”进行所有测试。在第一种情况下,您需要从代码中 GUI 与其交互的点开始测试,而在后一种情况下,您需要删除与数据库交互的服务。
重点是,有很多方法可以做到这一点。最好首先清楚地了解您想要从测试中获得什么。然后根据您想要测试的内容了解现有的框架可以帮助您,最后,不要试图在一夜之间征服世界。从小处开始,运行一些测试。获得绿色条(总是很高兴看到!)获得经过验证的稳定平台进行测试并确保您对此感到满意。然后随着你的进展添加更多。
If by "make integration tests and system tests" you mean automated tests, then the answer is no, there is no standard approach. What approach choose will depend on:
Personally, I love any approach that integrates with JUnit. JUnit is a fantastic framework which is well supported and easily tied into a continuous intergration server. Here are a few possible approaches:
The above examples provide a tremendous amount of out of the box help for testing. Of course, they still require effort to wire to your application and maintain, but the advantages are well worth it. In addition to the above, you may need to be thinking about how to stub or mock out areas of your application. Perhaps you want to do all of your testing "under the GUI" or "above the database". In the first scenario, you'll need your tests to start at the points in your code where the GUI would interact with it and in the latter you'll need to stub out the services which interact with your database.
Point being, there's lots of ways to do this. Best start with a very clear understanding of what you want to get out of your testing. Then learn what existing frameworks are out there to help you based on what you want to test, and finally, don't try to conquer the world in a night. Start small getting a few tests running. Get the green bar (always a joy to see!) Get a stable proven platform for testing and make sure you're happy with it. Then add more as you go along.