aoepeople/menta

Selenium 2 测试框架(用于PHPUnit)

安装: 831

依赖: 2

建议: 0

安全: 0

星标: 16

关注者: 43

分支: 10

dev-master 2016-01-06 13:32 UTC

This package is not auto-updated.

Last update: 2024-09-14 14:40:03 UTC


README

入门

设置测试文件夹结构

启动和自动加载

测试用例

配置处理

default.xml 与 phpunit xml 配置

组件

组件组织

项目特定组件 组件库(平台特定,代理特定) 重写机制以细化/覆盖

重写

使用 __() 进行翻译

辅助工具

Menta_Component_Helper_Common

Menta_Component_Helper_Assert

Menta_Component_Helper_Wait

Menta_Component_Helper_Screenshot

事件/观察者

配置

会话管理

重用浏览器会话

设置会话

屏幕截图

PHPUnit

基本类

Selenium1 extends Selenium2 extends PHPUnit

运行测试

cd /var/www
git clone --recursive git@git.aoesupport.com:users/fabrizio.branca/TestSkeleton.git

cd /var/www/TestSkeleton
./composer.phar install

cd /var/www/TestSkeleton/Tests
mkdir -p ../../build/reports

# Run single test
../vendor/bin/phpunit -c ../conf/devfb.ff.vmhost.xml General/ScreenshotsTest.php

# Run all tests
../vendor/bin/phpunit -c ../conf/devfb.ff.vmhost.xml ../vendor/aoemedia/menta/lib/Menta/Util/CreateTestSuite.php

# Report will be in /var/www/build/reports

HTML 报告

Jenkins 集成

文本结果

Sauce Labs

在 Sauce Labs 上运行

向 Sauce Labs 报告测试结果

/**
 * Will send the test result to sauce labs in case we're running tests there
 *
 * @return void
 */
protected function tearDown() {

	$sauceUserId = $this->getConfiguration()->getValue('testing.sauce.userId');
	$sauceAccessKey = $this->getConfiguration()->getValue('testing.sauce.accessKey');

	if (!empty($sauceUserId) && !empty($sauceAccessKey) && Menta_SessionManager::activeSessionExists()) {
		$status = $this->getStatus();
		$passed = !($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR || $status == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE);
		$rest = new WebDriver\SauceLabs\SauceRest($sauceUserId, $sauceAccessKey);
		$rest->updateJob(Menta_SessionManager::getSessionId(), array(WebDriver\SauceLabs\Capability::PASSED => $passed));
	}

	parent::tearDown();
}

Alt text