Run Behat Tests
bin/behat -c tests/behat/behat.profiles.yml --format pretty --out logs/report.txt --format junit --out logs/xml --format progress
bin/behat -c tests/behat/behat.profiles.yml --format pretty --out logs/report.txt --format junit --out logs/junitxml --format progress --no-colors
With Suite Spec
[setup@c7 behatmink]$ bin/behat -c tests/behat/behat.profiles.yml --format pretty --out logs/report.txt --format junit --out logs/junitxml --format progress --no-colors -p p_goutte --suite=smoke
tail phantomjs.log
tail -f /var/www/tools/phantomjs/phantomjs.log
report.txt
@drupal Feature: TestIng Home Page conent As an user, I want to be able to test the home page text Scenario: Home Page Title # features/smoke/home.feature:6 Given I am on "/" # Drupal\DrupalExtension\Context\MinkContext::visit() Then I should see "Drupal Testing" # Drupal\DrupalExtension\Context\MinkContext::assertPageContainsText() The text "Drupal Testing" was not found anywhere in the text of the current page. (Behat\Mink\Exception\ResponseTextException) Scenario: Footer Validation # features/smoke/home.feature:11 Given I am on "/" # Drupal\DrupalExtension\Context\MinkContext::visit() Then I should see "Copyright" # Drupal\DrupalExtension\Context\MinkContext::assertPageContainsText() And I should see "2018" # Drupal\DrupalExtension\Context\MinkContext::assertPageContainsText() @smoke Feature: Testing Home Page conent As an user, I want to be able to test the home page text Scenario: Home Page Title Check # features/smoke/login-custom.feature:6 Given I am on "/" # Drupal\DrupalExtension\Context\MinkContext::visit() Then I should see "Drupal Testing" # Drupal\DrupalExtension\Context\MinkContext::assertPageContainsText() The text "Drupal Testing" was not found anywhere in the text of the current page. (Behat\Mink\Exception\ResponseTextException) Scenario: testingThis Custom Function Works # features/smoke/login-custom.feature:17 Given I am on "/" # Drupal\DrupalExtension\Context\MinkContext::visit() Then Macro Log In As "TestAutomation" # Util\LoginContext::macroLogInAs() │ =============================================================== │ > Then Macro Log Out # Util\LoginContext::macroLogOut() │ =========================clickLink(Log out)====================================== │ ===================pageTextContains(Log in)============================================ │ =============================================================== │ Scenario: This Test Should Fail # features/smoke/login-custom.feature:28 Given I am on "/" # Drupal\DrupalExtension\Context\MinkContext::visit() Then Macro Step Pass # Util\LoginContext::pass() Then Macro Step Fail # Util\LoginContext::fail() Failed asserting that false is true. @drupal Feature: Login Validation As an anonymouse user and as an authenticated user I want to use the login feature Scenario: Invalid User Cannot Login # features/smoke/login.feature:7 Given I am on "/user/login" # Drupal\DrupalExtension\Context\MinkContext::visit() When I fill in "edit-name" with "test" # Drupal\DrupalExtension\Context\MinkContext::fillField() And I fill in "edit-pass" with "test" # Drupal\DrupalExtension\Context\MinkContext::fillField() And I press "edit-submit" # Drupal\DrupalExtension\Context\MinkContext::pressButton() Then I should see "Forgot" # Drupal\DrupalExtension\Context\MinkContext::assertPageContainsText() Scenario: Valid User Can Login # features/smoke/login.feature:15 Given I am on "/user/login" # Drupal\DrupalExtension\Context\MinkContext::visit() When I fill in "edit-name" with "test" # Drupal\DrupalExtension\Context\MinkContext::fillField() And I fill in "edit-pass" with "test" # Drupal\DrupalExtension\Context\MinkContext::fillField() And I press "edit-submit" # Drupal\DrupalExtension\Context\MinkContext::pressButton() Then I should see "Success" # Drupal\DrupalExtension\Context\MinkContext::assertPageContainsText() The text "Success" was not found anywhere in the text of the current page. (Behat\Mink\Exception\ResponseTextException) --- Failed scenarios: features/smoke/home.feature:6 features/smoke/login-custom.feature:6 features/smoke/login-custom.feature:28 features/smoke/login.feature:15 7 scenarios (3 passed, 4 failed) 23 steps (19 passed, 4 failed) 0m8.11s (10.91Mb)
script
nano /etc/systemd/system/phantomjs.service less /var/www/tools/phantomjs/phantomjs.log
Run Behat Tests
cd /var/www/behatmink/ bin/behat -c tests/behat/behat.profiles.yml --format pretty --out logs/report.txt --format junit --out logs/junitxml --format progress
View Output
less /var/www/behatmink/logs/report.txt cat /var/www/behatmink/logs/report.txt less /var/www/behatmink/logs/junitxml/default.xml
Output Options
--format pretty --out logs/report.txt --format junit --out logs/xml --format progress
Example
default: autoload: - "%paths.base%/features/bootstrap" suites: default: paths: features: "%paths.base%/features" #bootstrap: features/bootstrap contexts: - Drupal\FeatureContext - Util\LoginContext - Drupal\DrupalExtension\Context\DrupalContext - Drupal\DrupalExtension\Context\MinkContext - Drupal\DrupalExtension\Context\MessageContext - Drupal\DrupalExtension\Context\DrushContext smoke: paths: features: "%paths.base%/features/smoke" #bootstrap: features/bootstrap contexts: - Drupal\FeatureContext - Util\LoginContext - Drupal\DrupalExtension\Context\DrupalContext - Drupal\DrupalExtension\Context\MinkContext - Drupal\DrupalExtension\Context\MessageContext - Drupal\DrupalExtension\Context\DrushContext p_phantomjs: suites: default: paths: features: "%paths.base%/features" #bootstrap: features/bootstrap contexts: - Drupal\FeatureContext - Util\LoginContext - Drupal\DrupalExtension\Context\DrupalContext - Drupal\DrupalExtension\Context\MinkContext - Drupal\DrupalExtension\Context\MessageContext - Drupal\DrupalExtension\Context\DrushContext smoke: paths: features: "%paths.base%/features/smoke" contexts: - Drupal\FeatureContext - Util\LoginContext - Drupal\DrupalExtension\Context\DrupalContext - Drupal\DrupalExtension\Context\MinkContext - Drupal\DrupalExtension\Context\MessageContext - Drupal\DrupalExtension\Context\DrushContext extensions: Behat\MinkExtension: base_url: http://unityconstruct.org/uc/ selenium2: # webdriver port/socket wd_host: "http://localhost:8643/wd/hub" Drupal\DrupalExtension: blackbox: ~ region_map: footer: ".footer-menu" copyright: ".copyright" main_menu: "#main-menu" p_goutte: autoload: - "%paths.base%/features/bootstrap" suites: default: paths: features: "%paths.base%/features" contexts: - Drupal\FeatureContext - Util\LoginContext - Drupal\DrupalExtension\Context\DrupalContext - Drupal\DrupalExtension\Context\MinkContext - Drupal\DrupalExtension\Context\MessageContext - Drupal\DrupalExtension\Context\DrushContext smoke: paths: features: "%paths.base%/features/smoke" contexts: - Drupal\FeatureContext - Util\LoginContext - Drupal\DrupalExtension\Context\DrupalContext - Drupal\DrupalExtension\Context\MinkContext - Drupal\DrupalExtension\Context\MessageContext - Drupal\DrupalExtension\Context\DrushContext extensions: Behat\MinkExtension: base_url: http://unityconstruct.org/uc/ goutte: ~ selenium2: ~ Drupal\DrupalExtension: blackbox: ~ region_map: footer: ".footer-menu" copyright: ".copyright" main_menu: "#main-menu"
- Log in to post comments
Tags