在 Drupal 6 中使用 simpletest 自动机

发布于 2024-08-19 00:11:08 字数 228 浏览 7 评论 0原文

我一直在尝试学习如何使用 simpletest,并且找到了 simpletest 自动机。我能够安装并运行它,但是保存“宏”结果的文件在哪里?我一直没能找到它。

另外,有没有一种快速方法可以在 simpletest 中复制 drupal 安装?我知道它是从全新安装开始的,但我不想在测试开始时必须仔细检查并弄清楚所有内容都已启用以及谁拥有哪些权限。是否有一个脚本可以找出当前 drupal 安装的设置?

谢谢。

I've been trying to learn how to use simpletest, and I found the simpletest automator. I was able to install it and run it, but where is the file with the results of the 'macro' saved? I haven't been able to find it.

Also, is there a quick way to duplicate a drupal install in simpletest? I know it starts from a clean install, but I don't want to have to go through and figure out what all is enabled and who has what permissions at the start of the test. Is there a script that can figure out the settings of the current drupal install?

Thank You.

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

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

发布评论

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

评论(3

陈年往事 2024-08-26 00:11:08

是否有一个脚本可以找出当前drupal安装的设置?

简短的回答是否定的。

本质上 simpletest 应该用作单元测试框架。所有需要的数据都是在测试开始时设置的,并且不依赖于系统设置或具有权限的特定用户。它做得很好,并且可以轻松测试核心功能和单个模块。如果您正在测试使用 simpletest 编写的单个模块,那么很简单。

不幸的是,大多数网站都使用许多模块,并且被配置为以非常特定的方式协同工作。 Simpletest 不能很好地处理这个问题。

有多种方法可以解决这个问题:

一种选择是在 php 中编写一个设置脚本,它将作为测试的大型设置脚本。这可以创建用户、设置设置和权限。这可能难以编写和维护,并且可能导致测试需要很长时间才能运行。

另一种选择是使用 simpletest 以外的工具来完成站点测试(与单元测试不同)。我在 selenium 方面取得了一些成功。这样做的缺点是您需要找到一种获得干净数据的方法。这可能很棘手,复制数据库可以工作,但无法扩展。

Is there a script that can figure out the settings of the current drupal install?

The short answer is no.

Essentially simpletest should be used as a unit test framework. Where all of the data that is needed is set up at the beginning of the test and it is not reliant on system setting or a particular user having a permission. It does this quite well, and can test core functionality and individual modules easily. If you are testing an indavidual module you have written using simpletest is, well, simple.

Unfortunately most websites use a number of modules and are configured to work together in a very specific way. Simpletest doesn't cope with this very well.

There are ways to get around this:

One option is to write a setup script in php which will work as a big setup script for your test. This can create users, set settings and permissions. This can be dificult to write and maintain and can cause the tests to take a long time to run.

Another option is for the site testing (which is different from unit testing) to be done in a tool other than simpletest. I have had some success with selenium. The downside to this is that you need to find a way have clean data. Which can be tricky, copying a database works but doesn't scale.

淑女气质 2024-08-26 00:11:08

我被指出这篇博文作为问题的答案: http://www.trellon.com/content/blog/forcing-simpletest-use-live-database

I've been pointed to this blog post as an answer to the question: http://www.trellon.com/content/blog/forcing-simpletest-use-live-database

○闲身 2024-08-26 00:11:08

您还可以使用站点部署模块,并仅在最开始时启用该模块测试开始(在 SetUp() 函数中)。

You can also use a site deployment module and enable only that at the very beginning of your test (in your SetUp() function).

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