如何进行Web应用程序的全栈集成测试

发布于 2024-08-17 06:23:15 字数 1435 浏览 3 评论 0原文

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

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

发布评论

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

评论(1

究竟谁懂我的在乎 2024-08-24 06:23:15

听起来你在这条路上比我走得更远,但无论如何我都会发表评论。

我正在开发一个 JavaScript 项目(带有 Java + MySQL 后端),并决定使用 Selenium 进行测试,并尝试尽可能全面地覆盖。我还研究了一些其他测试工具,但我不能说我真的了解它们中的任何一个。从他们的网站来看,与 Selenium 相比,它们中没有一个显得非常精致或流行。我计划最终集成到 CruiseControl,但尚未这样做。

这是一个有趣的项目,归根结底,我对 Selenium 非常满意。 Selenium 优点:

  1. 测试“脚本”都可以用 Java 编写,不涉及晦涩的脚本语言。除此之外,您可以轻松地在测试之前和之后操作和验证数据库中的数据。
  2. Se 还支持 Perl、C# 等。我认为,尽管我对此不感兴趣。
  3. Selenium IDE 是一个很好的工具,可以快速了解 Se 的工作原理、定位器的工作原理等。您不想使用 IDE 长期实际运行测试,但它非常适合您入门并持续解决问题。
  4. Se 似乎与 jUnit 完美配合。可能还有 TestNG,但还没有尝试过,它在我的待办事项列表中。
  5. 优秀的文档和网站。

缺点:

  1. 我花了很多时间来弄清楚如何在所有情况下定位元素。这部分是我使用的框架(ExtJS)的“错误”,而不是Selenium。
  2. 似乎无论你做什么,Se 都有时间依赖性 - 例如。必须注入人工暂停才能使其正常工作的地方。
  3. 我的测试中也存在监视器大小的依赖性。我认为这是极其不可取的,但在某些地方它似乎是不可避免的。基本上,这是因为 JS 不支持您以编程方式单击许多元素类型。
  4. 与#3 相关,在一些地方我被迫驱动鼠标。这意味着您必须有一台专用的测试电脑。这没什么大不了的,但似乎不对。
  5. 测试很慢 - 主要是因为 Se 调用 Firefox 需要时间。毫无疑问,这部分是我的环境,我怀疑我可以做很多事情来改善这一点。然而,这确实很明显,但原因并不明显。运行大约 40 个测试大约需要 10 分钟。
  6. 支持论坛非常不稳定。嗯,一分钱一分货。但我一次又一次地发现有人发布了关于我的问题的帖子,而该帖子被忽略了,或者当OP指出该建议是伪造的时,提供了无效的解决方案而没有后续行动。

呵呵,干杯。

You sound like you are way further down this road than I am, but I'll comment anyway.

I am working on a JavaScript project (with a Java + MySQL back end) and decided to use Selenium for testing, and to try to achieve as thorough coverage as I could. I also poked around with a few other testing tools, but I can't say I really got to know any of them. None of them appeared, from their web sites, to be very polished or popular compared to Selenium. I am planning to integrate to CruiseControl eventually, but haven't done so yet.

This has been an interesting project and at the end of the day, I am quite happy with Selenium. Selenium plusses:

  1. Test 'scripts' can all be written in Java, no obscure scripting language involved. Among other things, you can easily do things like manipulate and verify the data in your database before and after tests.
  2. Se also supports Perl, C#, etc. I think, although that is of no interest to me.
  3. Selenium IDE is a great tool for quickly understanding how Se works, how locators work, etc. You don't want to actually run tests long-term using the IDE, but it's great for getting your feet wet, and for ongoing figuring things out.
  4. Se seems to work flawlessly with jUnit. Probably TestNG as well, but have not tried that yet, it's on my todo list.
  5. Excellent documentation and web site.

Minuses:

  1. I spent a LOT of time figuring out how to locate elements in all cases. This is partially the 'fault' of the framework I am using (ExtJS), not Selenium.
  2. It seems no matter what you do, Se has timing dependencies - eg. places where you have to inject artificial pauses to make it work.
  3. There are also monitor-size dependencies in my tests. I think this is extremely undesirable but in some places it seems to be unavoidable. Basically, this is because there are many element types that JS doesn't support you clicking on programatically.
  4. Related to #3, in places I am forced to drive the mouse. That means you have to have a dedicated test PC. Which is no big deal, but doesn't seem right.
  5. Tests are slow - mainly due to the time it takes Se to invoke Firefox. No doubt this is partially my environment, and I suspect I could do lots of things to improve this. However, it is really noticeable and not obvious why. It takes about 10 minutes to run about 40 tests.
  6. Support forum is very spotty. Well, you get what you pay for. But time and again I found someone had posted about my problem, and the post was ignored or else an invalid solution was offered with no follow-up when the OP pointed out that the suggestion was bogus.

HTH, cheers.

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