CentOS7: 02-VM Behat Mink

create /var/www/behatmink

mkdir /var/www/behatmink

 

chown behatmink to setup user

[setup@c7 www]$ sudo chown setup behatmink
[setup@c7 www]$ ls -la
total 0
drwxr-xr-x.  5 root  root  50 Nov  1 19:41 .
drwxr-xr-x. 20 root  root 278 Nov  1 19:27 ..
drwxrwxrwx.  2 setup root   6 Nov  1 19:41 behatmink
drwxr-xr-x.  2 root  root   6 Jun 27 08:49 cgi-bin
drwxr-xr-x.  2 root  root   6 Jun 27 08:49 html

 

 

git behatmink project

[setup@c7 www]$ git clone https://unityconstruct@bitbucket.org/unityconstruct/behatmink.git
Cloning into 'behatmink'...
Password for 'https://unityconstruct@bitbucket.org':
remote: Counting objects: 350, done.
remote: Compressing objects: 100% (322/322), done.
remote: Total 350 (delta 150), reused 0 (delta 0)
Receiving objects: 100% (350/350), 17.98 MiB | 6.17 MiB/s, done.
Resolving deltas: 100% (150/150), done.

 

pull composer

curl https://getcomposer.org/installer > composer-setup.php

 

make composer.phar

[setup@c7 composer]$ php composer-setup.php
All settings correct for using Composer
Downloading...

Composer (version 1.7.3) successfully installed to: /var/www/composer/composer.phar
Use it: php composer.phar

 

Build the behatmink composer projects

php composer.phar install

 

[setup@c7 behatmink]$ php composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 66 installs, 0 updates, 0 removals
  - Installing composer/installers (v1.6.0): Downloading (100%)         
  - Installing behat/gherkin (v4.5.1): Downloading (100%)         
  - Installing symfony/polyfill-mbstring (v1.9.0): Downloading (100%)         
  - Installing symfony/polyfill-ctype (v1.9.0): Downloading (100%)         
  - Installing symfony/dom-crawler (v4.1.6): Downloading (100%)         
  - Installing symfony/browser-kit (v4.1.6): Downloading (100%)         
  - Installing symfony/css-selector (v3.4.17): Downloading (100%)         
  - Installing behat/mink (v1.7.1): Downloading (100%)         
  - Installing behat/mink-browserkit-driver (1.3.3): Downloading (100%)         
  - Installing behat/transliterator (v1.2.0): Downloading (100%)         
  - Installing psr/container (1.0.0): Downloading (100%)         
  - Installing container-interop/container-interop (1.2.0): Downloading (100%)         
  - Installing symfony/polyfill-iconv (v1.9.0): Downloading (100%)         
  - Installing paragonie/random_compat (v2.0.17): Downloading (100%)         
  - Installing drupal/core-utility (8.6.1): Downloading (100%)         
  - Installing drupal/core-render (8.6.1): Downloading (100%)         
  - Installing symfony/event-dispatcher (v3.4.17): Downloading (100%)         
  - Installing symfony/dependency-injection (v3.4.17): Downloading (100%)         
  - Installing symfony/process (v3.4.17): Downloading (100%)         
  - Installing drupal/drupal-driver (v1.4.0): Downloading (100%)         
  - Installing instaclick/php-webdriver (1.4.5): Downloading (100%)         
  - Installing behat/mink-selenium2-driver (v1.3.1): Downloading (100%)         
  - Installing psr/http-message (1.0.1): Downloading (100%)         
  - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)         
  - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)         
  - Installing guzzlehttp/guzzle (dev-master 3ff39a4): Cloning 3ff39a4d6e
  - Installing fabpot/goutte (v3.2.3): Downloading (100%)         
  - Installing behat/mink-goutte-driver (v1.2.1): Downloading (100%)         
  - Installing symfony/filesystem (v4.1.6): Downloading (100%)         
  - Installing symfony/config (v4.1.6): Downloading (100%)         
  - Installing symfony/yaml (v4.1.6): Downloading (100%)         
  - Installing symfony/translation (v4.1.6): Downloading (100%)         
  - Installing symfony/console (v4.1.6): Downloading (100%)         
  - Installing symfony/class-loader (v3.4.17): Downloading (100%)         
  - Installing behat/behat (v3.5.0): Downloading (100%)         
    Skipped installation of bin bin/behat for package behat/behat: name conflicts with an existing file
  - Installing behat/mink-extension (2.3.1): Downloading (100%)         
  - Installing drupal/drupal-extension (v3.4.1): Downloading (100%)         
  - Installing drush-ops/behat-drush-endpoint (1.0.0): Downloading (100%)         
  - Installing webmozart/assert (1.3.0): Downloading (100%)         
  - Installing phpdocumentor/reflection-common (1.0.1): Downloading (100%)         
  - Installing phpdocumentor/type-resolver (0.4.0): Downloading (100%)         
  - Installing phpdocumentor/reflection-docblock (4.3.0): Downloading (100%)         
  - Installing phpunit/php-token-stream (2.0.2): Downloading (100%)         
  - Installing sebastian/version (2.0.1): Downloading (100%)         
  - Installing sebastian/resource-operations (1.0.0): Downloading (100%)         
  - Installing sebastian/recursion-context (3.0.0): Downloading (100%)         
  - Installing sebastian/object-reflector (1.1.1): Downloading (100%)         
  - Installing sebastian/object-enumerator (3.0.3): Downloading (100%)         
  - Installing sebastian/global-state (2.0.0): Downloading (100%)         
  - Installing sebastian/exporter (3.1.0): Downloading (100%)         
  - Installing sebastian/environment (3.1.0): Downloading (100%)         
  - Installing sebastian/diff (2.0.1): Downloading (100%)         
  - Installing sebastian/comparator (2.1.3): Downloading (100%)         
  - Installing phpunit/php-text-template (1.2.1): Downloading (100%)         
  - Installing doctrine/instantiator (1.1.0): Downloading (100%)         
  - Installing phpunit/phpunit-mock-objects (5.0.10): Downloading (100%)         
  - Installing phpunit/php-timer (1.0.9): Downloading (100%)         
  - Installing phpunit/php-file-iterator (1.4.5): Downloading (100%)         
  - Installing theseer/tokenizer (1.1.0): Downloading (100%)         
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)         
  - Installing phpunit/php-code-coverage (5.3.2): Downloading (100%)         
  - Installing phpspec/prophecy (1.8.0): Downloading (100%)         
  - Installing phar-io/version (1.0.1): Downloading (100%)         
  - Installing phar-io/manifest (1.0.1): Downloading (100%)         
  - Installing myclabs/deep-copy (1.8.1): Downloading (100%)         
  - Installing phpunit/phpunit (6.5.13): Downloading (100%)         
    Skipped installation of bin phpunit for package phpunit/phpunit: name conflicts with an existing file
behat/mink suggests installing behat/mink-zombie-driver (fast and JS-enabled headless driver for any app (requires node.js))
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
symfony/event-dispatcher suggests installing symfony/http-kernel
symfony/dependency-injection suggests installing symfony/expression-language (For using expressions in service container configuration)
symfony/dependency-injection suggests installing symfony/finder (For using double-star glob patterns or when GLOB_BRACE portability is required)
symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)
guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware)
symfony/translation suggests installing psr/log-implementation (To use logging capability in translator)
symfony/console suggests installing psr/log-implementation (For using the console logger)
symfony/console suggests installing symfony/lock
symfony/class-loader suggests installing symfony/polyfill-apcu (For using ApcClassLoader on HHVM)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.5)
phpunit/phpunit suggests installing ext-xdebug (*)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
Generating autoload files

 


Make Behat Executable

[setup@c7 bin]$ chmod +x behat
[setup@c7 bin]$ cd ..
[setup@c7 behatmink]$ cd bin/behat

 


Run Behat

[setup@c7 behatmink]$ bin/behat -c behat.yml
@smoke @class_test
Feature: Reflection Test Feature2
  As an user, I want to be able to perform
  reflection tests

  @smoke
  Scenario: Test Should Pass # features/smoke/ReflectionSmokeTest.feature:6
    Given Test Should Pass   # FeatureContext::testShouldPass()
    When Test Result Passes  # FeatureContext::testResultPasses()
    Then Test Case Passes    # FeatureContext::testCasePasses()

  @smoke
  Scenario: Test Should Fail # features/smoke/ReflectionSmokeTest.feature:12
    Given Test Should Pass   # FeatureContext::testShouldPass()
    When Test Result Passes  # FeatureContext::testResultPasses()
    Then Test Case Fails     # FeatureContext::testCaseFails()
      Failed asserting that false is true.

--- Failed scenarios:

    features/smoke/ReflectionSmokeTest.feature:12

2 scenarios (1 passed, 1 failed)
6 steps (5 passed, 1 failed)
0m0.06s (11.26Mb)