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

Plugins should be able to provide data generators for Behat

XMLWordPrintable

    • MOODLE_28_STABLE, MOODLE_38_STABLE
    • MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
    • Hide

      This is a behat thing. CiBoT will test it.

      However, if you want to run one .feature file to prove it, the one that has been converted to use the new mechanism is mod/quiz/tests/behat/quiz_reset.feature.

      Show
      This is a behat thing. CiBoT will test it. However, if you want to run one .feature file to prove it, the one that has been converted to use the new mechanism is mod/quiz/tests/behat/quiz_reset.feature.

      At the present time, it's not possible for the majority of Moodle's plugin types to provide their own data generators for use in Behat tests. This is a severe hindrance for plugin maintainers – we can't complete our test suites without a fix for this.

      This is because the current behat_data_generators::the_following_exist() implementation uses a hardcoded array of core-supplied data generators (behat_data_generators::$elements).

      Following a forum discussion, I believe that Moodle should provide a new plugin-specific the following "{:frankenstylecomponentname}" "{:elementname}s" exist syntax. The presence of this statement in a scenario would cause Moodle to instantiate the {$frankenstylecomponentname}_generator class and invoke the create_{$elementname} method to create the object.

      Acutally, the final decision for the form the step should take, similar to MDL-66559 and MDL-66335, is

      Given the following "mod_quiz > user overrides" exist:
            | quiz           | user     | attempts |
            | Test quiz name | student1 | 2        |
      

            timhunt Tim Hunt
            lukecarrier Luke Carrier
            Sam Marshall Sam Marshall
            Jake Dallimore Jake Dallimore
            CiBoT CiBoT
            Votes:
            9 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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