【发布时间】:2013-10-19 07:45:10
【问题描述】:
我正在使用 PHPUnit 和 Selenium 来测试我的 Web 应用程序。
目前我有 2 个测试类 - UserTest 和 PermissionsTest。
- 在 UserTest 中,我有一些方法可以测试程序能否成功创建新用户。
- 在 PermissionsTest 中,我打开和关闭某些权限并测试结果。
例如,我可能会关闭“创建用户”权限,然后测试“创建用户”按钮是否已禁用。但是,如果我重新打开“创建用户”权限,我想测试是否可以创建用户。
能够创建用户的所有逻辑都已经在 UserTest 类中 - 那么有什么方法可以从 PermissionsTest 类的 UserTest 类运行测试?
目前我正在尝试以下代码:
public function testUserPermission(){
$userTest = new UserTest();
if($this->hasPermission = true){
$userTest->testCanCreateUser();
}
}
但是,当我运行此测试时,我收到错误 "There is currently no active session to execute the 'execute' command. You're probably trying to set some option in setup() with an incorrect setter name..."
谢谢!
【问题讨论】:
标签: php selenium phpunit selenium-webdriver