[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/tests/behat/ -> behat_hooks.php (summary)

Behat hooks steps definitions. This methods are used by Behat CLI command.

Copyright: 2012 David Monllaó
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 582 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 7 files
 lib/testing/classes/test_lock.php
 lib/behat/classes/util.php
 lib/behat/behat_base.php
 lib/behat/classes/behat_command.php
 lib/testing/classes/nasty_strings.php
 lib/behat/classes/behat_context_helper.php
 lib/behat/classes/behat_selectors.php

Defines 2 classes

behat_hooks:: (16 methods):
  before_suite_hook()
  before_suite()
  before_feature()
  after_feature()
  after_suite()
  before_scenario_hook()
  before_scenario()
  before_step_javascript()
  after_step_javascript()
  after_scenario_switchwindow()
  get_run_faildump_dir()
  take_screenshot()
  take_contentdump()
  get_faildump_filename()
  i_look_for_exceptions()
  is_first_scenario()

behat_stop_exception:: (0 methods):


Class: behat_hooks  - X-Ref

Hooks to the behat process.

Behat accepts hooks after and before each
suite, feature, scenario and step.

They can not call other steps as part of their process
like regular steps definitions does.

Throws generic Exception because they are captured by Behat.

before_suite_hook(BeforeSuiteScope $scope)   X-Ref
Hook to capture BeforeSuite event so as to give access to moodle codebase.
This will try and catch any exception and exists if anything fails.

param: BeforeSuiteScope $scope scope passed by event fired before suite.

before_suite(BeforeSuiteScope $scope)   X-Ref
Gives access to moodle codebase, ensures all is ready and sets up the test lock.

Includes config.php to use moodle codebase with $CFG->behat_*
instead of $CFG->prefix and $CFG->dataroot, called once per suite.

param: BeforeSuiteScope $scope scope passed by event fired before suite.

before_feature(BeforeFeatureScope $scope)   X-Ref
Gives access to moodle codebase, to keep track of feature start time.

param: BeforeFeatureScope $scope scope passed by event fired before feature.

after_feature(AfterFeatureScope $scope)   X-Ref
Gives access to moodle codebase, to keep track of feature end time.

param: AfterFeatureScope $scope scope passed by event fired after feature.

after_suite(AfterSuiteScope $scope)   X-Ref
Gives access to moodle codebase, to keep track of suite timings.

param: AfterSuiteScope $scope scope passed by event fired after suite.

before_scenario_hook(BeforeScenarioScope $scope)   X-Ref
Hook to capture before scenario event to get scope.

param: BeforeScenarioScope $scope scope passed by event fired before scenario.

before_scenario(BeforeScenarioScope $scope)   X-Ref
Resets the test environment.

param: BeforeScenarioScope $scope scope passed by event fired before scenario.

before_step_javascript(BeforeStepScope $scope)   X-Ref
Wait for JS to complete before beginning interacting with the DOM.

Executed only when running against a real browser. We wrap it
all in a try & catch to forward the exception to i_look_for_exceptions
so the exception will be at scenario level, which causes a failure, by
default would be at framework level, which will stop the execution of
the run.

param: BeforeStepScope $scope scope passed by event fired before step.

after_step_javascript(AfterStepScope $scope)   X-Ref
Wait for JS to complete after finishing the step.

With this we ensure that there are not AJAX calls
still in progress.

Executed only when running against a real browser. We wrap it
all in a try & catch to forward the exception to i_look_for_exceptions
so the exception will be at scenario level, which causes a failure, by
default would be at framework level, which will stop the execution of
the run.

param: AfterStepScope $scope scope passed by event fired after step..

after_scenario_switchwindow(AfterScenarioScope $scope)   X-Ref
Executed after scenario having switch window to restart session.
This is needed to close all extra browser windows and starting
one browser window.

param: AfterScenarioScope $scope scope passed by event fired after scenario.

get_run_faildump_dir()   X-Ref
Getter for self::$faildumpdirname

return: string

take_screenshot(AfterStepScope $scope)   X-Ref
Take screenshot when a step fails.

param: AfterStepScope $scope scope passed by event after step.

take_contentdump(AfterStepScope $scope)   X-Ref
Take a dump of the page content when a step fails.

param: AfterStepScope $scope scope passed by event after step.

get_faildump_filename(AfterStepScope $scope, $filetype)   X-Ref
Determine the full pathname to store a failure-related dump.

This is used for content such as the DOM, and screenshots.

param: AfterStepScope $scope scope passed by event after step.
param: String $filetype The file suffix to use. Limited to 4 chars.

i_look_for_exceptions()   X-Ref
Internal step definition to find exceptions, debugging() messages and PHP debug messages.

Part of behat_hooks class as is part of the testing framework, is auto-executed
after each step so no features will splicitly use it.


is_first_scenario()   X-Ref
Returns whether the first scenario of the suite is running

return: bool

Class: behat_stop_exception  - X-Ref

Behat stop exception

This exception is thrown from before suite or scenario if any setup problem found.



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1