| OpenResty documentation | view source | Contained in the OpenResty distribution. |
OpenResty::Spec::RunTestsOnWin32_cn - Running the OpenResty test suite on Win32
本文档介绍了如何在 Win32 上建立一个 OpenResty 测试集的运行环境,测试本地的或者远方的 OpenResty 服务器。
从下面的位置下载 AgentPerl 安装程序(推荐使用 FlashGet 这样的多线程下载器):
http://agentzh.org/misc/win32/AgentPerl.exe
下载完毕后,双击即开始安装过程。应注意安装过程中不要轻易修改默认的设置,除非您知道自己在做什么 ;)
使用 ActiveState 的 ActivePerl 亦可,只不过需要手动安装一些 CPAN 模块,比如
Class::Prototyped, Test::LongString, Text::Diff, LWP::UserAgent, HTTP::Response, Cache::Cache, 以及 WWW::OpenResty.
首先安装 TortoiseSVN. TortoiseSVN 安装程序可以从 TortoiseSVN 官方网站取得。
取得 OpenResty 的 SVN head
在 TortoiseSVN 中 checkout 下面的地址:
http://svn.openfoundry.org/openapi/trunk
比如 checkout 到的地址目录是 C:\openresty.
将 C:\openresty\etc\openresty.conf 复制成同一目录下的 site_openresty.conf 文件.
编辑 site_openresty.conf 文件中的 [test_suite] 下的配置项,将 use_http 置为 1 (默认为 0),将 server 和 server2 选项更改为您自己的测试帐户,密码,以及主机名,一个例子是:
server=tester:password@api.openresty.org server2=tester2:password2@api.openresty.org
运行 OpenResty 测试集需要两个 OpenResty 测试帐户。因为有一些测试是针对跨帐户操作的。
首先在 [开始] -> [运行] 对话框输入 cmd 启动 Win32 的命令行终端.
然后用下面的命令把当前工作目录切换到您先前 checkout 出来的本地目录,比如 C:\openresty:
cd /d C:\openresty
运行整个测试集的方法是
C:\openresty> prove -Ilib -r t
prove -Ilib t/01-sanity.t
prove -Ilib t/01-sanity.t t/02-chunwen.t
prove -Ilib t/0*.t
--- ONLY
--- LAST
--- ONLY, --- LAST 等标签应当在调试结束后去除,不应提交到 SVN 仓库中去。 --- SKIP 标签。原则上不应随便修改现有的测试用例,推荐新添加的测试可以放到专门的 .t 文件中(按序号和功用正确命名)。
Agent Zhang (章亦春) <agentzh@yahoo.cn>
Copyright (c) 2007 Yahoo! China (中国雅虎公司).
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. A copy of the license can be found at
http://www.gnu.org/licenses/fdl.html
OpenResty::Spec::TestSuite, OpenResty.
| OpenResty documentation | view source | Contained in the OpenResty distribution. |