为复杂的应用程序从零开始编写基于 Selenium 的集成测试的最佳实践是什么?

发布于 2024-08-23 00:17:14 字数 570 浏览 6 评论 0原文

我正在寻找有关网络应用程序集成测试的一些建议和指示。我们的项目已经运行了很多年,而且相当复杂。我们已经很好地覆盖了单元测试,但是我们缺少一组像样的集成测试。除了我们的单元测试之外,我们没有记录的用例,甚至没有一组合理的测试用例。如今的“集成测试”包括开发人员对更改可能产生的影响的了解以及对应用程序的手动临时测试。这确实不理想 - 我们现在想要设计并自动化一组可靠的测试,以便我们能够执行回归测试,并增加我们对应用程序质量的信心。

我们最终构建了一个平台(基于 Selenium),使我们能够快速编写和自动化执行测试。现在的问题是:我们没有任何测试,页面完全是空白的。该系统有大约 30 个类,它们相互交互并影响 UI。对于注册的新用户,可以设置大约 40 个属性,每个属性都会影响体验。在用户的生命周期中,它们将生成更多的状态。考虑到如此多的变量和可能的状态,开始的前景令人畏惧,这可能就是迄今为止它被忽视的原因。

没有一套像样的测试的痛苦现在变得具有破坏性。我正在花时间来解决这个问题 - 我正在寻求一些关于测试编写的实用建议。你如何处理它?您有任何我可能觉得有用的链接吗?如何才能让我的大脑不再被看似无限的用户数据状态所困扰?我怎样才能清除失败的边缘情况(以及我们的用户似乎正在发现的情况)?

I am after some advice and pointers on integration testing for a web app. Our project has been running for a number of years, and it is reasonably complex. We are pretty well covered with unit tests, but we are missing a decent set of integration tests. We don't have documented use cases or even a reasonable set of test cases beyond our unit tests. 'Integration testing' today consists of the developer's knowledge of the likely impact of a change and manual, ad-hoc testing of the app. It is really not ideal - we now want to design and automate a solid set of tests to allow us to perform regression testing, and increase our confidence in the quality of the app.

We have finally built a platform (based on Selenium) to allow us to quickly author and automate the execution of the tests. The problem now: we don't have any tests, the page is well and truly blank. The system has around 30 classes which interact with each other and influence the UI. For a new user signing up, there are about 40 properties that can be set, with each once impacting the experience. Over the user life time they will generate even more states. Given so many variables and possible states, it is a daunting prospect to get started, which is probably why it has been neglected thus far.

The pain of not having a decent set of tests is now becoming destructive. I am dedicating time to get this problem fixed - I am after some practical advice on the authoring of the tests. How do you approach it? Do you have any links I may find useful? How can I stop my mind running away with the seemingly infinite number of states for a user's data? How can I flush out the edge cases which are failing (and our users seeming to be finding)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

走野 2024-08-30 00:17:14

如果正是大量的组合阻碍了您尝试生成测试用例,那么您绝对应该看看 全对测试

我们使用了 Microsoft 的 PICT 作为工具,成功地最大限度地减少了金额测试用例,同时仍然有合理的信心覆盖大多数用例。

全对测试背后的推理
是这样的:a中最简单的错误
程序通常由一个
单个输入参数。下一个
最简单的错误类别包括
那些依赖于相互作用的
参数对之间,可以
进行全对测试。1
涉及交互的错误
三个或更多参数是
逐渐不常见2,同时
同时正在逐步
通过详尽的查找更昂贵
测试,其限制是
对所有可能的情况进行详尽的测试
输入。

If it is the sheer amount of combinations that is holding you back in trying to generate testcases, you should definitly take a look at all-pair testing.

We have used PICT from microsoft as a tool to successfully minimize the amount of testcases while still being reasonable confident to have most cases covered.

the reasoning behind all-pairs testing
is this: the simplest bugs in a
program are generally triggered by a
single input parameter. The next
simplest category of bugs consists of
those dependent on interactions
between pairs of parameters, which can
be caught with all-pairs testing.1
Bugs involving interactions between
three or more parameters are
progressively less common2, whilst
at the same time being progressively
more expensive to find by exhaustive
testing, which has as its limit the
exhaustive testing of all possible
inputs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文