有没有办法将 RC Selenium 测试错误/失败记录到数据库中?

发布于 2024-08-08 05:46:48 字数 62 浏览 3 评论 0原文

我使用 phpunit & phpundercontrol 在每个构建上运行 RC Selenium。

Im using phpunit & phpundercontrol to run the RC Selenium on every build.

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

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

发布评论

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

评论(2

揽清风入怀 2024-08-15 05:46:48

PHPUnit 允许您实现自己的TestListener。自定义测试侦听器实现 PHPUnit_Framework_TestListener 接口中的抽象方法。具体来说,您的侦听器将实现:

  • startTestSuite()
  • endTestSuite()
  • startTest()
  • endTest()
  • addError()
  • addFailure()
  • addSkippedTest()
  • addIncompleteTest()

一旦附加了 TestListner,每次发生相应事件时都会调用这些方法你的测试套件。将编写这些方法来对您将创建的测试结果数据库执行INSERTUPDATE

将侦听器类附加到您的套件就像将 标记添加到 phpunit.xml 配置文件中一样简单。例如:

<phpunit>
  <testsuites>[...]</testsuites>
  <selenium>[...]</selenium>
  <listeners>
    <listener class="Database" 
              file="/usr/loocal/share/pear/PHPUnit/Util/Log/Database.php">
  </listeners>
</phpunit>

这就是你所需要的!

事实上,PHPUnit 已经附带了我刚才描述的侦听器的工作版本 (PHPUnit_Util_Log_Database),以及两个不同的数据库模式定义。

在许多系统上,此类将位于 /usr/local/share/pear/PHPUnit/Util/Log/Database.php 中,架构位于 /usr/local/share/pear/ 中PHPUnit/Util/Log/Database/MySQL.sql/usr/local/share/pear/PHPUnit/Util/Log/Database/SQLite3.sql。您可能需要根据您使用的 DBMS 进行一些调整。


请参阅文档的这些部分(它不会让我发布两个链接:

http://www.phpunit.de/manual/3.4/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestListener

htp://www.phpunit.de/manual/3.4/en /api.html#api.testresult.tables.testlistener

(StackOverflow 不允许我发布两个链接,因此您必须更正第二个链接中的 HTTP)

PHPUnit allows you to implement your own TestListener. Custom test listeners implement the abstract methods in the PHPUnit_Framework_TestListener interface. Specifically, your listener will implement:

  • startTestSuite()
  • endTestSuite()
  • startTest()
  • endTest()
  • addError()
  • addFailure()
  • addSkippedTest()
  • addIncompleteTest()

Once you've attached the TestListner these methods will be called each time the corresponding events occur in your test suite. These methods will be written to perform the INSERTs and UPDATEs on a test results database that you'll create.

Attaching the listener class to your suite is as easy as adding a tag to the phpunit.xml configuration file. For example:

<phpunit>
  <testsuites>[...]</testsuites>
  <selenium>[...]</selenium>
  <listeners>
    <listener class="Database" 
              file="/usr/loocal/share/pear/PHPUnit/Util/Log/Database.php">
  </listeners>
</phpunit>

That's all you need!

In fact, PHPUnit already comes with a working version of the listener I just described (PHPUnit_Util_Log_Database), as well as two different database schema definitions.

On many systems this class will live at /usr/loocal/share/pear/PHPUnit/Util/Log/Database.php, and the schemas at /usr/loocal/share/pear/PHPUnit/Util/Log/Database/MySQL.sql and /usr/loocal/share/pear/PHPUnit/Util/Log/Database/SQLite3.sql. You may have to do some tweaking depending on the DBMS you're using.


See these sections of the documentation (it wont let me post two links:

http://www.phpunit.de/manual/3.4/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestListener

htp://www.phpunit.de/manual/3.4/en/api.html#api.testresult.tables.testlistener

(StackOverflow won't let me post two links, so you'll have to correct the HTTP in that second one)

笑饮青盏花 2024-08-15 05:46:48

我正在解决同样的问题。

此处提出了相关问题几天前。

我尝试使用 Selenium IDE、Selenium RC 和 perl。

一般策略

您可以使较新版本的 phpunit 生成 TAP 输出(选项 --tap、--log-tap)。

(TAP 是 Test Anything Protocol - 标准化输出格式)

解析日志文件以从 TAP 解析器对象获取套件元数据,使用 perl 插入数据库,例如 "# Number of Passed": , "Failed", "Unexpectedly success",

I am working on the same problem.

Have asked a related question here a few days ago.

My attempt using Selenium IDE, Selenium RC and perl.

General strategy:

You can make newer releases of phpunit generate TAP output (options --tap, --log-tap).

(TAP is Test Anything Protocol - standardized output format)

Parse the logfile to obtain the suite metadata from the TAP parser object, insert into database using perl, e.g. "# Number of Passed": , "Failed", "Unexpectedly succeeded",

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