Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Typo - beaht -> behat

...

A sub-directory of: testing/beahtbehat/features

It is recommended that you place them in a sub directory based on the main area of Rogo you are testing, for example if you were testing that the details of a paper could be updated and had the desired effect you might place it in the papers sub-directory.

...

Code Block
titleExample step listing output
collapsetrue
frontend | Given /^the following "([^"]*)" exist:$/
frontend | Given /^I login as "([^"]*)"$/
frontend | Given /^I click "([^"]*)" "([^"]*)"$/
frontend |  Then /^I should see "([^"]*)" "([^"]*)"$/
frontend | Given /^I set the field "([^"]*)" to "([^"]*)"$/


backend | Given /^there are "([^"]*)" records in the "([^"]*)" table$/
backend | Given I store the database state
backend | Given I reset the database state
backend | Given /^the following "([^"]*)" exist:$/

...


The second gives a detailed list that includes information about what the step does:

...

Code Block
titleExample step listing output
collapsetrue
frontend | Given /^the following "([^"]*)" exist:$/
         | Adds records to the database using an appropriate data generator.
         | at `RogoBehatFrontend::the_following_exist()`

frontend | Given /^I login as "([^"]*)"$/
         | Log the user into Rogo.
         | at `RogoBehatFrontend::i_login_as()`

frontend | Given /^I click "([^"]*)" "([^"]*)"$/
         | Click on an element on the page.
         | at `RogoBehatFrontend::i_click()`

frontend | Then /^I should see "([^"]*)" "([^"]*)"$/
         | Checks for the presense of text.
         | at `RogoBehatFrontend::i_should_see()`

frontend | Given /^I set the field "([^"]*)" to "([^"]*)"$/
         | Fill in a form field.
         | at `RogoBehatFrontend::i_set_field()`

backend | Given /^there are "([^"]*)" records in the "([^"]*)" table$/
        | Checks that there are an expected number of rows in a database table.
        | at `RogoBehatBackend::there_are_records_in_the_table()`

backend | Given I store the database state
        | Saves the database state using the testing\behat\helpers\database\state class.
        | This step cannot be called twice without "I reset the database state" being
        | used between the calls.
        | at `RogoBehatBackend::i_store_the_database_state()`

backend | Given I reset the database state
        | Resets the database state using the testing\behat\helpers\database\state class
        | The "I store the database state" step must previously have been called.
        | at `RogoBehatBackend::i_reset_the_database_state()`

backend | Given /^the following "([^"]*)" exist:$/
        | Adds records to the database using an appropriate data generator.
        | at `RogoBehatBackend::the_following_exist()`

...


Test suites

The version of Behat used in Rogo allows us to define multiple test suites we have two defined.

...