PHPackages                             dalailomo/behato - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. dalailomo/behato

ActiveLibrary[Testing &amp; Quality](/categories/testing)

dalailomo/behato
================

Quick QA tool using behat

07PHP

Since Aug 18Pushed 8y agoCompare

[ Source](https://github.com/dalailomo/behato)[ Packagist](https://packagist.org/packages/dalailomo/behato)[ RSS](/packages/dalailomo-behato/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Behato
======

[](#behato)

Quick behavioural testing tool using [behat](http://behat.org/en/latest/) and [vvo/selenium-standalone](https://github.com/vvo/selenium-standalone).

Requirements
------------

[](#requirements)

- PHP &gt;= 5.6
- NodeJS &gt;= 7.10

Installation
------------

[](#installation)

Create a composer.json file with the following:

```
{
  "config": {
    "bin-dir": "bin/"
  },
  "minimum-stability": "dev",
  "require": {
    "dalailomo/behato": "dev-master"
  }
}
```

The require dependencies

```
$ composer install
```

Then, install the selenium server:

```
$ bin/installSeleniumStandalone
```

Create a config file called `behat.yml` in the root of your project with the following:

```
# behat.yml
default:
  suites:
    default:
      contexts:
        - BaseContext
        - Devinci\DevinciExtension\Context\DebugContext:
            asset_dump_path: ''
        - Devinci\DevinciExtension\Context\JavascriptContext:
            maximum_wait: 30
  extensions:
    Behat\MinkExtension:
      base_url:  ''
      browser_name: chrome
      sessions:
        default:
          #goutte: ~
          selenium2: ~
```

Then run `bin/behat --init`

Testing example
---------------

[](#testing-example)

### Set the parameters in the config file

[](#set-the-parameters-in-the-config-file)

- Change the `asset_dump_path` key to `%paths.base%/asset` (make sure you create a directory called `asset` on the root path of your project).
- Change the `base_url` key to `http://wikipedia.org`

### Create a feature file

[](#create-a-feature-file)

Now, create a file `features/search.feature` on `features` folder (this has been created by running `bin/behat --init`).

```
Feature: Search
  In order to see a word definition
  As a website user
  I need to be able to search for a word

  Scenario: Searching for a page that does exist
    Given I am on "/wiki/Main_Page"
    When I fill in "search" with "Behavior Driven Development"
    And I press "searchButton"
    Then I should see "agile software development"

  Scenario: Searching for a page that does NOT exist
    Given I am on "/wiki/Main_Page"
    When I fill in "search" with "Glory Driven Development"
    And I press "searchButton"
    Then I should see "Search results"
```

Now, go to the file `features/bootstrap/BaseContext.php` and change the contents by the following:

```
