我正在尝试为使用Codeception 1.8和Selenh的somehwat-legacy PHP和JavaScript应用程序设置新的测试结构。如果有人不知道Codeception(http://codeception.com/),它有几个选项可用于运行包含内置PHP浏览器的测试,但基本上是PHPUnit的增强版本。它具有用于运行单元,功能和验收测试的套件。使用Selenium JAR和WebDriver在独立机器上运行代码测试
我按照“快速入门”(http://codeception.com/quickstart)中的说明操作,并且欢呼雀跃,PHP浏览器成功运行了一个超级简单的验收测试。我遇到的问题是当我尝试更改配置如何运行这些测试的YAML文件时 - 我想停止使用PHPBrowser,并切换到Selenium,以便可以编写涉及DOM和JS的端到端样式测试。
起初,我有让chromedriver工作的问题 - 我从来没有这样做,实际上,我无法升级我的Codeception版本,因为我正在使用的代码库很难在PHP版本5.3.29中设置。但是,我发现这里有一台单独的服务器安装了PhantomJS。
这很重要,因为我无法在运行selenium JAR(fileserver 1)的机器上安装sudo install,也没有安装PhantomJS(webserver 1)的机器。所以我无法自己安装firefox驱动程序或其他webdriver。
我的问题是:有没有办法在WebDriver托管在另一台机器上的情况下运行我的Selenium测试?有没有办法在远程机器上使用WebDriver来让Selenium运行,或者WebDriver和Selenium JAR必须位于同一台机器上?
作为另一个附加说明,两台服务器都在同一主域 - 它们分别是fileserver1.domain.com
和webserver1.domain.com
(显然都是假的URL)。
这里是我的YAML配置文件为我codeception设置:
codeception主要YAML
paths:
tests: tests
log: tests/_log
data: tests/_data
helpers: tests/_helpers
settings:
bootstrap: _bootstrap.php
suite_class: \PHPUnit_Framework_TestSuite
colors: true
memory_limit: 1024M
log: true
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql
验收测试YAML
# Codeception Test Suite Configuration
class_name: WebGuy
modules:
enabled:
# - PhpBrowser
# - Selenium2
- WebDriver
- WebHelper
config:
WebDriver:
url: 'https://.../login_logout.php?superuser'
browser: chrome
window_size: 1024x768
# PhpBrowser:
# url: 'https://.../login_logout.php?superuser'
任何帮助,不胜感激!
webdriver的是Codeception模块进行对话的硒,内置的东西被称为PhpBrowser。 – Naktibalda
呵呵,你说得对,我把WebDriver解释为PhpBrowser – daison12006013