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

Add a tool to execute behat generators in the current instance

XMLWordPrintable

    • MOODLE_404_STABLE
    • MOODLE_404_STABLE
    • MDL-80096-master-v02
    • Hide

      Automated acceptance tests cover all web features.

      Manual test: test CLI version

      1. Open a terminal in an empty instance root folder. Some steps can have different outputs if the instance has courses or users that collide with the ones in admin/tool/generator/tests/fixtures/testscenario/scenario.feature. The instance must be empty.
      2. Note the absolute path to your instance root. You will need it to replace "/INSTANCEABSOLUTEPATH" in the next steps.
      3. Execute: php admin/tool/generator/cli/runtestscenario.php
        1. This will install composer. Important: this validation does not apply if your instance has composer libraries installed. If that is the case, ignore this validation. Check one of the last output lines is: Generating autoload files
      4. Execute again: php admin/tool/generator/cli/runtestscenario.php
        1. Check the output: Missing feature file path.
      5. Execute: php admin/tool/generator/cli/runtestscenario.php --feature=/INSTANCEABSOLUTEPATH/admin/tool/generator/tests/fixtures/testscenario/scenario.feature
        1. Check the final line of the output is: All steps executed successfully.
        2. Ensure that the course "Course test" exist with 5 students and one teacher enrolled.
      6. Execute again: php admin/tool/generator/cli/runtestscenario.php --feature=/INSTANCEABSOLUTEPATH/admin/tool/generator/tests/fixtures/testscenario/scenario.feature
        1. Course and user creation will fail when executed twice.
        2. Check the final line of the output is: Some steps failed.
        3. Check the next-to-last line is: 3/6 steps executed successfully.
      7. Execute: php admin/tool/generator/cli/runtestscenario.php --feature=/INSTANCEABSOLUTEPATH/admin/tool/generator/tests/fixtures/testscenario/scenario_wrongempty.feature
        1. Check the output contains: The file is not valid: There are no steps to execute in the file.
      8. Execute: php admin/tool/generator/cli/runtestscenario.php --feature=/INSTANCEABSOLUTEPATH/admin/tool/generator/tests/fixtures/testscenario/scenario_wrongformat.feature
        1. Check the output contains: Error parsing feature file
      9. Execute: php admin/tool/generator/cli/runtestscenario.php --feature=/INSTANCEABSOLUTEPATH/admin/tool/generator/tests/fixtures/testscenario/scenario_wrongonlybackground.feature
        1. Check the output contains: The file is not valid: There are no steps to execute in the file.
      10. Execute: php admin/tool/generator/cli/runtestscenario.php --feature=/INSTANCEABSOLUTEPATH/admin/tool/generator/tests/fixtures/testscenario/scenario_wrongstep.feature
        1. Check the output contains: The file is not valid: The file format is not valid or contains invalid steps.
      Show
      Automated acceptance tests cover all web features. Manual test: test CLI version Open a terminal in an empty instance root folder. Some steps can have different outputs if the instance has courses or users that collide with the ones in admin/tool/generator/tests/fixtures/testscenario/scenario.feature. The instance must be empty. Note the absolute path to your instance root. You will need it to replace "/INSTANCEABSOLUTEPATH" in the next steps. Execute: php admin/tool/generator/cli/runtestscenario.php This will install composer. Important: this validation does not apply if your instance has composer libraries installed. If that is the case, ignore this validation. Check one of the last output lines is: Generating autoload files Execute again: php admin/tool/generator/cli/ runtestscenario .php Check the output: Missing feature file path. Execute: php admin/tool/generator/cli/ runtestscenario .php --feature=/INSTANCEABSOLUTEPATH/admin/tool/generator/tests/fixtures/testscenario/scenario.feature Check the final line of the output is: All steps executed successfully. Ensure that the course "Course test" exist with 5 students and one teacher enrolled. Execute again: php admin/tool/generator/cli/runtestscenario.php --feature=/INSTANCEABSOLUTEPATH/admin/tool/generator/tests/fixtures/testscenario/scenario.feature Course and user creation will fail when executed twice. Check the final line of the output is: Some steps failed. Check the next-to-last line is: 3/6 steps executed successfully. Execute: php admin/tool/generator/cli/ runtestscenario .php --feature=/INSTANCEABSOLUTEPATH/admin/tool/generator/tests/fixtures/testscenario/scenario_wrongempty.feature Check the output contains: The file is not valid: There are no steps to execute in the file. Execute: php admin/tool/generator/cli/ runtestscenario .php --feature=/INSTANCEABSOLUTEPATH/admin/tool/generator/tests/fixtures/testscenario/scenario_wrongformat.feature Check the output contains: Error parsing feature file Execute: php admin/tool/generator/cli/ runtestscenario .php --feature=/INSTANCEABSOLUTEPATH/admin/tool/generator/tests/fixtures/testscenario/scenario_wrongonlybackground.feature Check the output contains: The file is not valid: There are no steps to execute in the file. Execute: php admin/tool/generator/cli/ runtestscenario .php --feature=/INSTANCEABSOLUTEPATH/admin/tool/generator/tests/fixtures/testscenario/scenario_wrongstep.feature Check the output contains: The file is not valid: The file format is not valid or contains invalid steps.
    • HQ 2023 Sprint I4.1 Moppies

      The problem to solve

      Many manual testing instructions require creating elements like courses, users, activities and enrolments. These repetitive actions can be replaced by executing some behat generators in the current instance.

      As an extra benefit, testers or devs using gitpod, could use this feature to initialize testing scenarios when the docker container is created.

      The solution proposed

      Add a new "create testing scenario" to tool_behat. This new feature will allow users to upload a limited feature file that contains only generator steps.

      Because generator steps do not use selenium or other browser-related actions, the generators can be executed directly in the current instance.

      The feature must be executable on both web and CLI versions. The CLI can be executed when creating a docker container, for example.

            tusefomal Ferran Recio
            tusefomal Ferran Recio
            Laurent David Laurent David
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days, 4 hours, 27 minutes
                2d 4h 27m

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