php自动测试软件,php-appium

Appium PHP Client

An extension library to add Selenium 3 features to Appium.

The library is installable using the Composer dependency manager. Just add "appium/appium-php": "dev-master" (or any other branch/tag you might like) to your composer.json file's requires, and the repository on GitHub to the repositories:

{

"name":"username/my-php-project",

"repositories":[

{

"type":"vcs",

"url":"https://github.com/appium/php-client"

}

],

"require":{

"appium/php-client":"dev-master"

}

}

Have an instance of Appium running in the background at port 4723. Then install the dependencies and run your tests:

composer install

vendor/phpunit/phpunit/phpunit

For more details about your tests add the --verbose flag to phpunit

Usage and changes

There are a number of methods added to Selenium 3/Appium 1. The central change is in the test case that serves as the base of your tests, and the elements with which you interact. Both are subclasses of the PHPUnit Selenium classes. Your tests should be subclasses of PHPUnit_Extensions_AppiumTestCase, and all elements that get returned will be of the class PHPUnit_Extensions_AppiumTestCase_Element.

require_once('PHPUnit/Extensions/AppiumTestCase.php');

require_once('PHPUnit/Extensions/AppiumTestCase/Element.php');

class MySuperTests extends PHPUnit_Extensions_AppiumTestCase

{

public static $browsers = array(

array(

'local' => true,

'port' => 4723,

'browserName' => '',

'desiredCapabilities' => array(

'app' => APP_PATH

)

)

);

public function testStuff()

{

$element = $this->byAccessibilityId('Element on screen');

$this->assertInstanceOf('PHPUnit_Extensions_AppiumTestCase_Element', $element);

}

}

Methods added

Methods in PHPUnit_Extensions_AppiumTestCase

byIOSUIAutomation

byAndroidUIAutomator

byAccessibilityId

keyEvent

pullFile

pushFile

backgroundApp

isAppInstalled

installApp

removeApp

launchApp

closeApp

endTestCoverage

lock

shake

getDeviceTime

hideKeyboard

initiateTouchAction

initiateMultiAction

scroll

dragAndDrop

swipe

tap

pinch

zoom

startActivity

getSettings

setSettings

Methods in PHPUnit_Extensions_AppiumTestCase_Element

byIOSUIAutomation

byAndroidUIAutomator

byAccessibilityId

setImmediateValue

Methods for Touch Actions and Multi Gesture Touch Actions

Appium 1.0 allows for much more complex ways of interacting with your app through Touch Actions and Multi Gesture Touch Actions. The PHPUnit_Extensions_AppiumTestCase_TouchAction class allows for the following events:

tap

press

longPress

moveTo

wait

release

All of these except tap and release can be chained together to create arbitrarily complex actions. Instances of the PHPUnit_Extensions_AppiumTestCase_TouchAction class are obtained through the Test Class's initiateTouchAction method, and dispatched through the perform method.

The Multi Gesture Touch Action API allows for adding an arbitrary number of Touch Actions to be run in parallel on the device. Individual actions created as above are added to the multi action object (an instance of PHPUnit_Extensions_AppiumTestCase_MultiAction obtained from the Test Class's initiateMultiAction method) through the add method, and the whole thing is dispatched using perform.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值