【发布时间】:2012-02-20 12:57:33
【问题描述】:
我有一个应用程序通过设置到我的应用程序域的 cookie 使用外部服务。在开发过程中,我手动创建了这个 cookie,但在生产中,这个 cookie 将通过登录生成。在我为这个外部服务运行测试之前,有什么方法可以使用我在开发过程中设置的 cookie?
我猜想我可以使用 curl 稍微自动化一下,但我想知道我是否遗漏了 PHPUnit 和/或 Selenium 中的一些隐藏功能或技术。
[类扩展PHPUnit_Extensions_SeleniumTestCase]
/**
* Can get the current authenticated user.
*/
public function testCanGetTheCurrentAuthenticatedUser()
{
$this->open('http://my/local/virtual/host/api/getCurrentUser');
$json = json_decode($this->getBodyText());
$this->assertEquals('25', $json->response->id);
}
【问题讨论】:
标签: unit-testing selenium phpunit