vendredi 1 juillet 2016

Behat test "Then I should see Laravel 5" fails in laravel application

In my new Laravel application (created by $ composer create-project laravel/laravel my_app), I type:

$ php -S localhost:8888 -t public

And in the browser (Safari or Chrome) on localhost:8888 I successfully see black text "Laravel 5" on the webpage.

I have a hometest.feature file in features/ that looks like:

Feature:
  In order to prove that Behat works as intended
  We want to test the home page for a phrase
  Scenario: Root Test
    When I am on the homepage
    Then I should see "Laravel 5"

I also have a /features/bootstrap/FeaturesContext.php file.

The localhost is not currently running when I run:

$ vendor/bin/behat

The console output is:

Feature:
  In order to prove that Behat works as intended
  We want to test the home page for a phrase

  Scenario: Root Test             # features/hometest.feature:5
    When I am on the homepage     # FeatureContext::iAmOnHomepage()
    Then I should see "Laravel 5" # FeatureContext::assertPageContainsText()
      The text "Laravel 5" was not found anywhere in the text of the current page. (Behat\Mink\Exception\ResponseTextException)

--- Failed scenarios:

    features/hometest.feature:5

1 scenario (1 failed)
2 steps (1 passed, 1 failed)
0m0.12s (20.26Mb)

Why does my simple "I should see 'Laravel 5' test fail? If the localhost needs to be running, how do I run my test at the same time? When I start up the local host, nothing I type in the terminal receives a response anymore. Thank you!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire