Details

    • Database:
      MySQL
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      Script for generating all sorts of course data, through web browser or CLI. Migrated from Contrib CONTRIB-490

        Gliffy Diagrams

        There are no Sub-Tasks for this issue.

          Activity

          Hide
          Tim Hunt added a comment -

          Nico, what is the status of this? Isn't it done?

          Show
          Tim Hunt added a comment - Nico, what is the status of this? Isn't it done?
          Hide
          Martin Dougiamas added a comment -

          Reassigning this to moodle.com for the time being, since Mark Nielsen is not maintaining Lesson any more. Please comment/vote/patch any crucial bugs that affect you for 2.0 to help us prioritise fixes for the upcoming release.

          Show
          Martin Dougiamas added a comment - Reassigning this to moodle.com for the time being, since Mark Nielsen is not maintaining Lesson any more. Please comment/vote/patch any crucial bugs that affect you for 2.0 to help us prioritise fixes for the upcoming release.
          Hide
          Tomasz Muras added a comment -

          Patch in MDL-25796 and commits on github:
          https://github.com/enovation/moodle/tree/MDL-16177
          will make the generator script usable again.

          After those two are merged, there will be still work left on MDL-16420 - this can be done on module by module basis.

          Show
          Tomasz Muras added a comment - Patch in MDL-25796 and commits on github: https://github.com/enovation/moodle/tree/MDL-16177 will make the generator script usable again. After those two are merged, there will be still work left on MDL-16420 - this can be done on module by module basis.
          Hide
          Wen Hao Chuang added a comment -

          Can we make some efforts to push this into the core code? Personally I really like this script as it can save a lot of time generating a lot of testing data.. Just my 2 cents. Thanks!

          Show
          Wen Hao Chuang added a comment - Can we make some efforts to push this into the core code? Personally I really like this script as it can save a lot of time generating a lot of testing data.. Just my 2 cents. Thanks!
          Hide
          Dan Marsden added a comment -

          I'm not sure I'd like to see this in core - generator scripts are for developers - if we add it to core and someone runs it on their production site it could be a pain to tidy up - unless we write a reliable/safe clean up script at the same time.

          If this did land in core - it should only be possible to enable it by hard coding a CFG var - it should always be disabled by default.

          Show
          Dan Marsden added a comment - I'm not sure I'd like to see this in core - generator scripts are for developers - if we add it to core and someone runs it on their production site it could be a pain to tidy up - unless we write a reliable/safe clean up script at the same time. If this did land in core - it should only be possible to enable it by hard coding a CFG var - it should always be disabled by default.
          Hide
          Tomasz Muras added a comment -

          The actual generation doesn't need to be in the core but see MDL-16420 - what we need is plugins supporting generating random data. And this should be in the core - simply as part of core activities.
          Keep in mind that this adds maintenance overhead for the modules - whenever some logic is updated, random data generation functions may need to be updated.

          Show
          Tomasz Muras added a comment - The actual generation doesn't need to be in the core but see MDL-16420 - what we need is plugins supporting generating random data. And this should be in the core - simply as part of core activities. Keep in mind that this adds maintenance overhead for the modules - whenever some logic is updated, random data generation functions may need to be updated.
          Hide
          Dan Marsden added a comment -

          that makes sense - is there some code around already for this?

          Show
          Dan Marsden added a comment - that makes sense - is there some code around already for this?
          Hide
          Tim Hunt added a comment -

          I think that anything done here should build upon the same framework that is used to generate data for the PHPunit and Behat tests. That infrastructure is in Moodle core, and the bits specific to each plug-in are in that plugin. For example in mod/quiz/tests/generator/.... What this issue should be about is about exposing a UI to let developers randomly generate lots of stuff for testing. That should be done as a plugin (an admin tool?). Does that plugin go in core (like XMLDB or phpunit) or does it go in contrib (like codechecker)? Well, it does not matter for now. It should be developed in contrib, and it would be great if someone could work on it.

          Show
          Tim Hunt added a comment - I think that anything done here should build upon the same framework that is used to generate data for the PHPunit and Behat tests. That infrastructure is in Moodle core, and the bits specific to each plug-in are in that plugin. For example in mod/quiz/tests/generator/.... What this issue should be about is about exposing a UI to let developers randomly generate lots of stuff for testing. That should be done as a plugin (an admin tool?). Does that plugin go in core (like XMLDB or phpunit) or does it go in contrib (like codechecker)? Well, it does not matter for now. It should be developed in contrib, and it would be great if someone could work on it.
          Hide
          Tomasz Muras added a comment -

          +1 to make it the same effort as mod/*/tests/generator. The UI for the actual generation of the random data should be a contrib plugin, there is no need to make it part of core. I wouldn't even be interested in UI, just a CLI interface, so I can automate it easily.

          The framework is there but there is a lot of work for core modules to support it. Most of the modules don't have anything under mod/*/tests/generator and those that do - only support basics, e.g. I can see that quiz module can create new quiz instance but generator can't fill it with random data (random questions and then random answers for user's data).

          Show
          Tomasz Muras added a comment - +1 to make it the same effort as mod/*/tests/generator. The UI for the actual generation of the random data should be a contrib plugin, there is no need to make it part of core. I wouldn't even be interested in UI, just a CLI interface, so I can automate it easily. The framework is there but there is a lot of work for core modules to support it. Most of the modules don't have anything under mod/*/tests/generator and those that do - only support basics, e.g. I can see that quiz module can create new quiz instance but generator can't fill it with random data (random questions and then random answers for user's data).
          Hide
          Tim Hunt added a comment -

          Well, this will happen with time. For example, Jamie Pratt is just starting some work on the quiz reports, which will involve extneding the generator to be able to generate questions and quiz attempts.

          Show
          Tim Hunt added a comment - Well, this will happen with time. For example, Jamie Pratt is just starting some work on the quiz reports, which will involve extneding the generator to be able to generate questions and quiz attempts.
          Hide
          Tomasz Muras added a comment -

          In that case, I think that generator work should be postponed until we have at least few core modules supporting data generation. Unless we get someone interested in the development and willing to push it forward.

          Show
          Tomasz Muras added a comment - In that case, I think that generator work should be postponed until we have at least few core modules supporting data generation. Unless we get someone interested in the development and willing to push it forward.
          Hide
          Marina Glancy added a comment -

          Nicolas, Tomasz, can you please update what is the status of this issue?
          We have quite comprehensive testing API by now that includes plenty of generators. It is used in unittests and behat tests. There is also a script for test course generation included in standard moodle package (as well as request to remove it - MDL-42823 ).

          And I agree that tools for generating data in the main database should not be in standard moodle package. This can be dangerous for production sites.

          I was making a presentation about different ways to generate data on one of dev meetings:
          https://docs.google.com/presentation/d/1iQnjdmHZ_CQp44iQRqocxUuV19_idTMHikZ6GL54v1Y/pub?start=false&loop=false&delayms=3000
          It has example of code how to generate course and modules in the main DB.
          Since Moodle 2.6 thera are generators for all standard modules.

          I suggest to close this issue. What do you think?

          Show
          Marina Glancy added a comment - Nicolas, Tomasz, can you please update what is the status of this issue? We have quite comprehensive testing API by now that includes plenty of generators. It is used in unittests and behat tests. There is also a script for test course generation included in standard moodle package (as well as request to remove it - MDL-42823 ). And I agree that tools for generating data in the main database should not be in standard moodle package. This can be dangerous for production sites. I was making a presentation about different ways to generate data on one of dev meetings: https://docs.google.com/presentation/d/1iQnjdmHZ_CQp44iQRqocxUuV19_idTMHikZ6GL54v1Y/pub?start=false&loop=false&delayms=3000 It has example of code how to generate course and modules in the main DB. Since Moodle 2.6 thera are generators for all standard modules. I suggest to close this issue. What do you think?
          Hide
          Dan Poltawski added a comment -

          Note that the origins of this bug are the original generator tool which has now been removed. I suggest it should be closed and anything extra created as separate issues.

          git log --grep=MDL-16177
          commit c20b6845175490a0c51b74730e26b73647da7054
          Author: nicolasconnault <nicolasconnault>
          Date:   Mon Jun 22 00:52:36 2009 +0000
           
              MDL-16177 Detecting if script is called from URL, in which case it prints header, footer and form. Otherwise, silently create a global $generator object that can be used by unit tests.
           
          commit b2313a2abeb1d370fa837e681210008e6ca13e3d
          Author: nicolasconnault <nicolasconnault>
          Date:   Tue Sep 16 18:57:01 2008 +0000
           
              MDL-16177
           
          commit 7a8977d5fb168c5fb079a825345ff298ced8ca6a
          Author: nicolasconnault <nicolasconnault>
          Date:   Wed Sep 10 15:14:44 2008 +0000
           
              MDL-15666 MDL-16177 Fixed pgsql bug
           
          commit 7e95408b01c1ef771ea62087931e9ffa938839e3
          Author: nicolasconnault <nicolasconnault>
          Date:   Fri Aug 29 08:01:55 2008 +0000
           
              MDL-15666 MDL-16177
              Refactored the generator script into proper Object Oriented code. It can now be used as a CLI tool, as a web form or as an included library with a function call. Stub implementation is demonst
           
          commit db1d500007708e6399ab4030c32a1dd3e9e651d8
          Author: nicolasconnault <nicolasconnault>
          Date:   Sat Aug 23 06:58:00 2008 +0000
           
              MDL-16177 Moving to admin folder
           
          commit f4c2e8a690b1140fb3635e8994a0b5f939d6c586
          Author: nicolasconnault <nicolasconnault>
          Date:   Fri Aug 22 19:40:41 2008 +0000
           
              MDL-16177 Added generation of forum discussions and posts, with multiple users and nesting of replies.
           
          commit 923f607020a2cac3b8392d629339fa71ea591351
          Author: nicolasconnault <nicolasconnault>
          Date:   Fri Aug 22 14:05:52 2008 +0000
           
              MDL-16177 Brought generator script from contrib to HEAD so it can be used and maintained by core developers.
          

          Show
          Dan Poltawski added a comment - Note that the origins of this bug are the original generator tool which has now been removed. I suggest it should be closed and anything extra created as separate issues. git log --grep=MDL-16177 commit c20b6845175490a0c51b74730e26b73647da7054 Author: nicolasconnault <nicolasconnault> Date: Mon Jun 22 00:52:36 2009 +0000   MDL-16177 Detecting if script is called from URL, in which case it prints header, footer and form. Otherwise, silently create a global $generator object that can be used by unit tests.   commit b2313a2abeb1d370fa837e681210008e6ca13e3d Author: nicolasconnault <nicolasconnault> Date: Tue Sep 16 18:57:01 2008 +0000   MDL-16177   commit 7a8977d5fb168c5fb079a825345ff298ced8ca6a Author: nicolasconnault <nicolasconnault> Date: Wed Sep 10 15:14:44 2008 +0000   MDL-15666 MDL-16177 Fixed pgsql bug   commit 7e95408b01c1ef771ea62087931e9ffa938839e3 Author: nicolasconnault <nicolasconnault> Date: Fri Aug 29 08:01:55 2008 +0000   MDL-15666 MDL-16177 Refactored the generator script into proper Object Oriented code. It can now be used as a CLI tool, as a web form or as an included library with a function call. Stub implementation is demonst   commit db1d500007708e6399ab4030c32a1dd3e9e651d8 Author: nicolasconnault <nicolasconnault> Date: Sat Aug 23 06:58:00 2008 +0000   MDL-16177 Moving to admin folder   commit f4c2e8a690b1140fb3635e8994a0b5f939d6c586 Author: nicolasconnault <nicolasconnault> Date: Fri Aug 22 19:40:41 2008 +0000   MDL-16177 Added generation of forum discussions and posts, with multiple users and nesting of replies.   commit 923f607020a2cac3b8392d629339fa71ea591351 Author: nicolasconnault <nicolasconnault> Date: Fri Aug 22 14:05:52 2008 +0000   MDL-16177 Brought generator script from contrib to HEAD so it can be used and maintained by core developers.
          Hide
          Marina Glancy added a comment -

          Thanks for the comment Dan. Closing

          Show
          Marina Glancy added a comment - Thanks for the comment Dan. Closing

            People

            • Votes:
              11 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: