Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-66675

Add pause on fail option to behat

XMLWordPrintable

    • MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
    • MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
    • MDL-66675-master
    • Hide

      Test

      1. Drop the attached 66675.feature into lib/tests/behat
      2. Initialise behat
      3. Run just that feature file
        1. Confirm that the first test was paused after a few steps
      4. Press [Enter/return]
        1. Confirm that the test continue running
        2. Confirm that the dots for the test continued on the line below the Enter message
        3. Confirm that the dots started straight after the previous set finished
      5. The test will continue running until...
        1. Confirm that the test failed
        2. Confirm that the reason for the failure was shown
        3. Confirm that you the test was not paused
      6. Edit your config.php and set:

        $CFG->behat_pause_on_fail = true;
        

      7. Run just that feature file again
        1. Confirm that the test paused in the same place as before
      8. Continue the test
      9. The test will continue running until...
        1. Confirm that the test failed
        2. Confirm that the reason for the failure was shown
        3. Confirm that the test paused at the failure point
      10. Press [Enter/return]
        1. Confirm that the rest of the steps were skipped running
        2. Confirm that the dots for the test continued on the line below the Enter message
        3. Confirm that the dots started straight after the previous set finished

      Example output

      Started at 19-09-2019, 07:37
      ........
      Paused. Press Enter/Return to continue.
              ...............
      Scenario failed. Paused for inspection. Press Enter/Return to continue.
      Exception follows:
      Link matching locator "Participants" not found.
                             F---
       
      --- Failed steps:
       
      001 Scenario: A test fails automatically on a failure # /Users/nicols/Sites/moodles/sm/moodle/lib/tests/behat/66675.feature:38
            When I follow "Participants"                    # /Users/nicols/Sites/moodles/sm/moodle/lib/tests/behat/66675.feature:42
              Link matching locator "Participants" not found. (Behat\Mink\Exception\ElementNotFoundException)
       
      2 scenarios (1 passed, 1 failed)
      27 steps (23 passed, 1 failed, 3 skipped)
      3m0.05s (52.70Mb)
      

      Show
      Test Drop the attached 66675.feature into lib/tests/behat Initialise behat Run just that feature file Confirm that the first test was paused after a few steps Press [Enter/return] Confirm that the test continue running Confirm that the dots for the test continued on the line below the Enter message Confirm that the dots started straight after the previous set finished The test will continue running until... Confirm that the test failed Confirm that the reason for the failure was shown Confirm that you the test was not paused Edit your config.php and set: $CFG->behat_pause_on_fail = true; Run just that feature file again Confirm that the test paused in the same place as before Continue the test The test will continue running until... Confirm that the test failed Confirm that the reason for the failure was shown Confirm that the test paused at the failure point Press [Enter/return] Confirm that the rest of the steps were skipped running Confirm that the dots for the test continued on the line below the Enter message Confirm that the dots started straight after the previous set finished Example output Started at 19-09-2019, 07:37 ........ Paused. Press Enter/Return to continue. ............... Scenario failed. Paused for inspection. Press Enter/Return to continue. Exception follows: Link matching locator "Participants" not found. F---   --- Failed steps:   001 Scenario: A test fails automatically on a failure # /Users/nicols/Sites/moodles/sm/moodle/lib/tests/behat/66675.feature:38 When I follow "Participants" # /Users/nicols/Sites/moodles/sm/moodle/lib/tests/behat/66675.feature:42 Link matching locator "Participants" not found. (Behat\Mink\Exception\ElementNotFoundException)   2 scenarios (1 passed, 1 failed) 27 steps (23 passed, 1 failed, 3 skipped) 3m0.05s (52.70Mb)

      When tracking down behat fails it's helpful to be able to pause when the test fails.

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Sam Marshall Sam Marshall
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 40 minutes
                5h 40m

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