Uploaded image for project: 'Moodle Community Sites'
  1. Moodle Community Sites
  2. MDLSITE-3778

POLICY: Allow multiple Given-When-Then in acceptance tests

XMLWordPrintable

      Since davmon introduced us to Gherkin he also introduced us to the concept that there should be only one given-when-then in each test. It does not make any technical difference, is only a principle.

      Here is a short example from course/tests/behat/course_search.feature

      Then I should see "Successfully moved 2 courses into Science"
      And I wait to be redirected
      And I click on category "Science" in the management interface
      And I should see "Biology Y1"
      And I should see "Biology Y2"
      

      All those 'And' are a bit weird.. and it might be nicer to read if it was:

      Then I should see "Successfully moved 2 courses into Science"
      And I wait to be redirected
      When I click on category "Science" in the management interface
      Then I should see "Biology Y1"
      And I should see "Biology Y2"
      

      This comes from industry best practice:
      http://docs.behat.org/en/latest/guides/1.gherkin.html
      https://github.com/cucumber/cucumber/wiki/Given-When-Then
      http://guide.agilealliance.org/guide/gwt.html

      But its caused a lot of controversy - search the tracker and chat-logs and you will see practically every developer has hit against this.

      Should we stick by this way?

            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.