Overview

Classes

  • VideoTestWebTestCaseDriver
  • VideoTestWebTestCaseDriverFunctions
  • Overview
  • Class

Class VideoTestWebTestCaseDriver

Custom Selenium Driver, which adds some animation functions.

usage:
  public function setUp(){
    Yii::import('application.vendor.videotest.VideoTestWebTestCaseDriver');
    $this->drivers[0]=VideoTestWebTestCaseDriver::attach($this->drivers[0], $this);
    parent::setUp();
  }

  public function testABC(){
    $this->videoInit();
    $this->open('');
    $this->videoStart('ABC');
    $this->videoShowMessage('Test ABC');
    ...
  }

Configuration:

Yii::app()->params['selenium-video']['fast']
  *  set to 1 to skip animation and make test run faster during development
  *  set to 2 to skip all visual effects completely
  *  set to 0 or false for default (slow, animated) behavior

Inside the test you can override this value by using following functions:

*   $this->videoSlow() -- equal to setting configuration value to 0
  *   $this->videoFast() -- equal to setting configuration value to 1
  *   $this->videoSkip() -- equal to setting configuration value to 2
  *   $this->videoDefault() -- returns to default setting from configuration

These functions can be configured to be ignored on CI server -- set Yii::app()->params['selenium-video']['ignore-fast-override'] to true in your local CI config

Located at VideoTestWebTestCaseDriver.php
Methods summary
public static PHPUnit_Extensions_SeleniumTestCase_Driver
# attach( PHPUnit_Extensions_SeleniumTestCase_Driver $driver, CWebTestCase $testCase )

Creates driver object which wraps original one adding our functions

Creates driver object which wraps original one adding our functions

Parameters

$driver
current driver. See Usage above
$testCase
current test case. See Usage above

Returns

PHPUnit_Extensions_SeleniumTestCase_Driver
driver to be placed to $this->drivers[0]
public mixed
# __get( string $name )

Wrapper magic getter

Wrapper magic getter

Parameters

$name

Returns

mixed
public
# __set( string $name, mixed $value )

Wrapper magic setter

Wrapper magic setter

Parameters

$name
$value
public mixed
# __call( string $fn, array $args )

Wrapper magic method Routes calls started with "video" to our driver, and hides errors, that can be introduced by our driver

Wrapper magic method Routes calls started with "video" to our driver, and hides errors, that can be introduced by our driver

Parameters

$fn
$args

Returns

mixed
public
# doTry( $params = array() )

Trial-and-error method for writing video tests

Trial-and-error method for writing video tests

Magic method to save some time when making video tests - it allows you change the code during test execution (thus keeping browser open) and retry until code works.

Usual usage simply put following line at the appropriate place of your code:

$this->doTry(get_defined_vars()); } function t(){

This line will split your test function into two functions - one will end with ->doTry() call, and another one will go into the t() test function

This doTry() function will call test function t in an indefinite loop asking you to press Enter in the test console after each turn. All exceptions will be caught and displayed instead of making test fail.

As soon as a piece of code works (i.e. it clicks appropriate button or link) - you move working code from t() function up to your test function.

After code works - you should have your t() function empty and simply remove the ->doTry() line.

Parameters

$params
array of parameters to be passed to the test function
public
# say( mixed $msg )

just dumps values during test execution. To be used for debugging tests

just dumps values during test execution. To be used for debugging tests

Parameters

$msg
can be of any type, since print_r will be used
Properties summary
protected $driver
#
protected $testCase
#
protected $functions
#
API documentation generated by ApiGen