Download the PHP package cw/behat_test without Composer

On this page you can find all versions of the php package cw/behat_test. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package behat_test

GUIDE

Link What do you want to do?
Initial Set-up If you are the first person on the project to install this framework, please complete the initial set-up steps
Onbording to a project If the framework is already part of your project repo, please complete the onboarding steps
Ongoing Update If you are only updating the framework, please complete the ongoing update steps
Test Execution How to run tests?
Test Results Where to find the test results?
Behat test writing process How to write new tests?

Dependenices

Composer

This command will download and install Composer as a system-wide command named composer, under /usr/local/bin.

Java

Java v1.7 is required.

INITIAL SET-UP

  1. Select a location for the framework

    Create a folder, ideally in a Test folder in your project, outside your Drupal webroot.

  2. Create a composer JSON file Composer

    Create a composer.json file in the test folder root.

  3. Install via Composer

    From the Test folder created st step 1, run:

  4. Create the Behat folder structure

    Run the bootstrap shell script:

  5. Update your local configuration

    In your Test folder, edit Behat/behat.local.yml. Update:

  1. Configure Chrome - Optional Step

    This is only required if you want to run tests on Chrome. Skip to step 7 if you don't.

(By default, Firefox works out-of-the-box.)

  1. Download chromedriver from http://chromedriver.storage.googleapis.com/index.html?path=2.17/
  2. Save it to /usr/local/bin

  3. Verify Setup Successful

    Navigate to the Behat folder inside your Test folder:

Execute the following:

Selenium will launch and run a test. You should see 1 scenarios (1 passed) in the terminal window after 15-20 seconds.

ONBOARDING TO A PROJECT

  1. Install via Composer

    From the project Test folder, run:

  2. Create the Behat folder structure

    Run the bootstrap shell script:

  3. Update your local configuration

    In your Test folder, edit Behat/behat.local.yml. Update:

  1. Configure Chrome - Optional Step

    This is only required if you want to run tests on Chrome. Skip to step 7 if you don't.

(By default, Firefox works out-of-the-box.)

  1. Download chromedriver from http://chromedriver.storage.googleapis.com/index.html?path=2.17/
  2. Save it to /usr/local/bin

  3. Verify Setup Successful

    Navigate to the Behat folder inside your Test folder:

Execute the following:

Selenium will launch and run a test. You should see 1 scenarios (1 passed) in the terminal window after 15-20 seconds.

ONGOING UPDATE

  1. Update via Composer

    From the project Test folder, run:

  2. Update the Behat folder structure

    Run the bootstrap shell script:

Test Execution

Navigate to the Behat folder inside your Test folder:

To execute all of the tests, select one of the following options based on the format ./run-behat.sh [tag] [profile]:

or

Test Results

The results of all tests will be stored in /Results/Behat/Twig_***.html

Behat test writing process

It is a good idea to read through the LOGIN feature, page, and context files while reading through the following descriptions.

In the following, XXXX is the name of the page being tested, e.g. Basic, Article, Login, etc.

"ACTION" indicates a step that you have to do.

The basic process for writing any test would be:

1. SCENARIOS

Decide on a business scenario that you would like to automate.

This often comes from a User Story or piece of functionality that you'd like to test.

For the rest of the following, let's think of a login scenario where a user is going:

2. FEATURE file

This file contains the high-level test scenarios written in a Gherkin syntax.

These files are located in Behat/features/.

They all follow the naming convention XXXX.feature.

For example, in the LoginPage.feature, there are tests to ensure a valid login is successful.

ACTION: Create a .feature file, using the template provided, and write your scenario into the .feature file.

Follow the syntax used in other tests.

Where possible, re-use existing sentences from the .feature file as these will already have been automated.

If you are creating a new sentence, keep it short but descriptive.

3. PAGE.php file

This file contains the path, page objects, and getters/setters for all the fields on the page XXXX.

These files are located in src/Util/.

They all follow the naming convention XXXXPage.php.

For example, in the LoginPage.php, there are the username, password, and login button objects detailed.

ACTION: Create a Page.php file, and add the objects to it.

For Create/Edit/View content types, you generally want to add every object that an end-user would use to the XXXXPage.php file.

Using the template provided, create your XXXXPage.php file.

Take care to separate textfields, buttons, frames, etc, and follow the syntax and naming conventions from other PAGE files.

Where possible, always use IDs for your objects. If IDs are not available, consider using name, data-drupal-selector, or xpath.

4. CONTEXT.php file

This file contains all of the functions that are specific to the XXXX page.

These files are located in src/Context.

They all follow the naming convention XXXXContext.php.

For example, in the LoginContext.php, there are functions to fill in the username and password fields, and press the login button.

ACTION: Create a XXXXContext.php file, and add the relevant functions to interact with the objects from the Page.php file.

This file will detail function for interacting with your objects.

The number of functions you write will vary from context to context - typically, the more complicated a UI is, the more functions will be required.

Follow the syntax and naming conventions from other CONTEXT files.

Keep all functions as short as possible, ideally doing one thing each, like filling in a text field.

5. behat.yml file

This file contains most of the configuration settings that are required for behat to run.

Every new feature file that gets created will require that a new entry is made to this file.

ACTION: Follow the example of the login from lines 3-15. Copy and paste this inside the default profile, and update the login values with the correct values.

TAGS

@todo: Please add section detailing the tagging process.

TROUBLESHOOTING

  1. If you get API rate limit messages during the ./bootstrap.sh step, please see: API rate limit and OAuth tokens.

  2. If you get the folowing when running the tests, please upgrade your version of java:

    Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/grid/selenium/GridLauncher : Unsupported major.minor version 51.0

  3. If you get errors related to timezone settings, add the following to your path profile (with the appropriate version of PHP):

    export PATH="/Applications/MAMP/bin/php/php5.6.7/bin:$PATH"

CREDITS

This work is sponsored and supported by Cameron & Wilding, a London Drupal Agency.


All versions of behat_test with dependencies

PHP Build Version
Package Version
Requires drupal/drupal-extension Version 3.2.2
emuse/behat-html-formatter Version 0.1.0
phpunit/phpunit Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cw/behat_test contains the following files

Loading the files please wait ....