您的网络应用程序或网站是否有健康检查?

时间:2022-08-26 19:01:48

I have built PHP based "health check" scripts for several projects in the past, but they were always custom-made for the occasion and not written for abstraction as an independent product. I would like to know whether such a solution exists.

我过去为几个项目构建了基于PHP的“运行状况检查”脚本,但它们总是为场合定制,而不是作为独立产品进行抽象编写。我想知道是否存在这样的解决方案。

What I meam by "health check" is a protected web page that functions much like a suite of unit tests, but on a more operational level, showing red/yellow/green statuses for things like

我通过“健康检查”获得的是一个受保护的网页,其功能与单元测试相似,但在更具操作性的级别上,显示红色/黄色/绿色状态等

  • Are the cache directories writable?
  • 缓存目录是否可写?
  • Is the PHP version correct, are required extensions installed?
  • PHP版本是否正确,是否安装了必需的扩展?
  • Is the database server reachable?
  • 数据库服务器是否可访问?
  • Do the necessary tables exist in the database?
  • 数据库中是否存在必要的表?
  • Is there enough disk space available?
  • 有足够的磁盘空间可用吗?
  • Is the site's front page reachable and renders fully ( = no PHP errors)?
  • 网站的首页是否可以访问并完全呈现(=没有PHP错误)?
  • Do the project's libraries' MD5 checksums match the original ones?
  • 项目库的MD5校验和是否与原始校验和匹配?
  • Does the front page's output pass the W3C validator?
  • 首页的输出是否通过了W3C验证器?

Do you do this - or parts of it - in your applications and web sites?

您是否在您的应用程序和网站中执行此操作或部分操作?

Are there any standardized tools for this that bring along all the functionality to perform the tests (ideally as plugins), and just need to be configured accordingly?

是否有任何标准化工具可以带来执行测试的所有功能(理想情况下是插件),只需要相应配置?

I am talking about a lightweight solution that can run even on the tiniest of PHP-based web packages with no extensions and server access.

我说的是一个轻量级的解决方案,甚至可以在最小的基于PHP的Web包上运行,没有扩展和服务器访问。

Is there, maybe, a way to set this up using one of the Unit Testing frameworks available for PHP (preferably PHPUnit)? If so, do you know any resources / tutorials outlining how?

也许有一种方法可以使用一个可用于PHP的单元测试框架(最好是PHPUnit)来设置它?如果是这样,你知道如何概述任何资源/教程吗?

Update: There does not seem to be a popular ready-made solution for this, otherwise, with more than 100 views, I'm sure there would have been some mention of it. Seeing as there's some initial interest in building such a tool as an open source project, please feel free to post what an ideal solution for you would look like, and what features it would have to have.

更新:似乎没有一个流行的现成解决方案,否则,有超过100个视图,我相信会有一些提及它。由于最初对构建开源项目这样的工具感兴趣,请随时发布一个理想的解决方案,以及它必须具备的功能。

3 个解决方案

#1


3  

Interesting question, but this is pretty broad. I haven't seen an unit testing tool yet which does all the backend, midend and frontend testing at once. I checked this list, but no one does it all. There is however one generic approach, xUnit (fully automated testing).

有趣的问题,但这是相当广泛的。我还没有看到一个单元测试工具,它可以立即执行所有后端,中端和前端测试。我检查了这个清单,但没有人做到这一切。然而,有一种通用的方法,xUnit(全自动测试)。

The major blockers are that backend testing is platform/DB specific and that midend testing is programming-language specific. And then yet to combine those limitations with frontend testing. The tool should then have to support almost all languages and platforms the world is aware of. I don't think such tool would ever be available in open source world. It's an utopia.

主要的阻碍是后端测试是特定于平台/数据库的,并且中端测试是特定于编程语言的。然后将这些限制与前端测试结合起来。然后,该工具必须支持世界所知的几乎所有语言和平台。我不认为这种工具在开源世界中是可用的。这是一个乌托邦。

In theory it's indeed possible to have a testing framework with plugin capabilities, maybe based on the xUnit ideology, but one has yet to write/invent/opensource it. You? It's indeed a hole in the market.

从理论上讲,确实有可能拥有一个带有插件功能的测试框架,可能基于xUnit意识形态,但是还没有编写/发明/开源它。您?这确实是市场上的一个漏洞。

At any way, for frontend unit testing (HTML/CSS/JS/forms) I would recommend Selenium, or if you have the money, TestComplete. I have seen it been used at IBM several years back, it was awesome to see it in action and the testers were very happy with this.

无论如何,对于前端单元测试(HTML / CSS / JS /表格),我会推荐Selenium,或者如果你有钱,TestComplete。我已经看到它在几年前在IBM上使用过,看到它在运行中非常棒,测试人员对此非常满意。

For midend unit testing (programming code, the business logic), just continue with the programming language specific unit testing tools like PHPUnit for PHP and JUnit for Java.

对于中端单元测试(编程代码,业务逻辑),只需继续使用PHPUnit for PHP和JUnit for Java等编程语言特定的单元测试工具。

Regarding backend unit testing (DB, filesystem), I've used PGTap for PostgreSQL, but there are also generic DB tools available for this such as SQLUnit (which is however last updated almost 4 years back...). For the local disk file system conditions you'll have to grab platform specific scripting languages.

关于后端单元测试(DB,文件系统),我已经将PGTap用于PostgreSQL,但也有一些通用的数据库工具,例如SQLUnit(不过它最近更新了4年......)。对于本地磁盘文件系统条件,您必须获取特定于平台的脚本语言。

#2


0  

Check out Nagios. It can be configured to poll URLs and scan for the presence/absence of strings, look for certain response codes, and quite a bit of other stuff. If you expose the stuff you want to look for in a URL, Nagios can do the rest.

看看Nagios。它可以配置为轮询URL并扫描字符串的存在/不存在,查找某些响应代码以及相当多的其他内容。如果您在URL中公开要查找的内容,Nagios可以完成剩下的工作。

@Franz Nagios support costs money, but the core monitoring software is free. It's kinda the Redhat model.

@Franz Nagios支持费用,但核心监控软件是免费的。这有点像Redhat模型。

#3


0  

You can do all these with CruiseControl and phpUnderControl. But of course, you need to specify all those tasks you want to execute so your project pass all checks.

您可以使用CruiseControl和phpUnderControl完成所有这些操作。但是,当然,您需要指定要执行的所有任务,以便项目通过所有检查。

http://topecoders.blogspot.com/2010/04/how-to-install-cruisecontrol.html

http://topecoders.blogspot.com/2010/04/how-to-install-cruisecontrol.html

With CruiseControl, you may add multiple tasks to be executed for every build of your project.

使用CruiseControl,您可以为项目的每个构建添加多个要执行的任务。

#1


3  

Interesting question, but this is pretty broad. I haven't seen an unit testing tool yet which does all the backend, midend and frontend testing at once. I checked this list, but no one does it all. There is however one generic approach, xUnit (fully automated testing).

有趣的问题,但这是相当广泛的。我还没有看到一个单元测试工具,它可以立即执行所有后端,中端和前端测试。我检查了这个清单,但没有人做到这一切。然而,有一种通用的方法,xUnit(全自动测试)。

The major blockers are that backend testing is platform/DB specific and that midend testing is programming-language specific. And then yet to combine those limitations with frontend testing. The tool should then have to support almost all languages and platforms the world is aware of. I don't think such tool would ever be available in open source world. It's an utopia.

主要的阻碍是后端测试是特定于平台/数据库的,并且中端测试是特定于编程语言的。然后将这些限制与前端测试结合起来。然后,该工具必须支持世界所知的几乎所有语言和平台。我不认为这种工具在开源世界中是可用的。这是一个乌托邦。

In theory it's indeed possible to have a testing framework with plugin capabilities, maybe based on the xUnit ideology, but one has yet to write/invent/opensource it. You? It's indeed a hole in the market.

从理论上讲,确实有可能拥有一个带有插件功能的测试框架,可能基于xUnit意识形态,但是还没有编写/发明/开源它。您?这确实是市场上的一个漏洞。

At any way, for frontend unit testing (HTML/CSS/JS/forms) I would recommend Selenium, or if you have the money, TestComplete. I have seen it been used at IBM several years back, it was awesome to see it in action and the testers were very happy with this.

无论如何,对于前端单元测试(HTML / CSS / JS /表格),我会推荐Selenium,或者如果你有钱,TestComplete。我已经看到它在几年前在IBM上使用过,看到它在运行中非常棒,测试人员对此非常满意。

For midend unit testing (programming code, the business logic), just continue with the programming language specific unit testing tools like PHPUnit for PHP and JUnit for Java.

对于中端单元测试(编程代码,业务逻辑),只需继续使用PHPUnit for PHP和JUnit for Java等编程语言特定的单元测试工具。

Regarding backend unit testing (DB, filesystem), I've used PGTap for PostgreSQL, but there are also generic DB tools available for this such as SQLUnit (which is however last updated almost 4 years back...). For the local disk file system conditions you'll have to grab platform specific scripting languages.

关于后端单元测试(DB,文件系统),我已经将PGTap用于PostgreSQL,但也有一些通用的数据库工具,例如SQLUnit(不过它最近更新了4年......)。对于本地磁盘文件系统条件,您必须获取特定于平台的脚本语言。

#2


0  

Check out Nagios. It can be configured to poll URLs and scan for the presence/absence of strings, look for certain response codes, and quite a bit of other stuff. If you expose the stuff you want to look for in a URL, Nagios can do the rest.

看看Nagios。它可以配置为轮询URL并扫描字符串的存在/不存在,查找某些响应代码以及相当多的其他内容。如果您在URL中公开要查找的内容,Nagios可以完成剩下的工作。

@Franz Nagios support costs money, but the core monitoring software is free. It's kinda the Redhat model.

@Franz Nagios支持费用,但核心监控软件是免费的。这有点像Redhat模型。

#3


0  

You can do all these with CruiseControl and phpUnderControl. But of course, you need to specify all those tasks you want to execute so your project pass all checks.

您可以使用CruiseControl和phpUnderControl完成所有这些操作。但是,当然,您需要指定要执行的所有任务,以便项目通过所有检查。

http://topecoders.blogspot.com/2010/04/how-to-install-cruisecontrol.html

http://topecoders.blogspot.com/2010/04/how-to-install-cruisecontrol.html

With CruiseControl, you may add multiple tasks to be executed for every build of your project.

使用CruiseControl,您可以为项目的每个构建添加多个要执行的任务。