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

Javascript unit testing

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: Future Dev
    • Fix Version/s: DEV backlog
    • Component/s: Policy, Unit tests
    • Labels:
    • Testing Instructions:
      Hide
      1. With the plugin installed go to the Admin tree -> Development -> JSUnit
      2. The block_community test SHOULD be executed
      3. Create a new YUI test module
        1. You can copy & paste blocks/community/yui/commentstest/commentstest.js as another yui module (More info in http://docs.moodle.org/dev/JSUnit#Creating_tests)
        2. Execute the test again, the results SHOULD be correct and the different tests indentations SHOULD respect the following ul/li tags structure:
      • Name: I'm the test case name (name setting of Y.Test.TestCase)
      • Passed tests: N
      • Failed tests: N
        • Name: test_name
        • Result: pass|fail
        • Message: Test passed|*
      • Name: I'm another test case name
      • Passed tests: N
      • Failed tests: N
        • Name: test_another_name
        • Result: pass|fail
        • Message: Test passed|*
        • Name: test_another_one
        • Result: pass|fail
        • Message: Test passed|*
      Show
      With the plugin installed go to the Admin tree -> Development -> JSUnit The block_community test SHOULD be executed Create a new YUI test module You can copy & paste blocks/community/yui/commentstest/commentstest.js as another yui module (More info in http://docs.moodle.org/dev/JSUnit#Creating_tests ) Execute the test again, the results SHOULD be correct and the different tests indentations SHOULD respect the following ul/li tags structure: Name: I'm the test case name (name setting of Y.Test.TestCase) Passed tests: N Failed tests: N Name: test_name Result: pass|fail Message: Test passed|* Name: I'm another test case name Passed tests: N Failed tests: N Name: test_another_name Result: pass|fail Message: Test passed|* Name: test_another_one Result: pass|fail Message: Test passed|*
    • Pull Master Branch:
      MDL-35595-master
    • Documentation link:

      Description

      YUI includes a unit testing framework (http://yuilibrary.com/projects/yuitest/) but is not used by Moodle, it could be good to have an execution wrapper to allow Moodle components to write unit tests for it's YUI 3 modules; the YUI test version included in the YUI 3 library allows testing of all kind of JS, not only YUI modules (they can be tested inside a YUI 3 module) It outputs the tests results in different formats including JUnitXML

      Working on it during the STABLE team week off.

      If it needs to be executed from CLI there is an available tool YUI yeti (http://yuilibrary.com/projects/yeti/) with Node.js dependencies that can test JS code against multiple browsers.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              dmonllao David Monllaó
              Participants:
              Component watchers:
              Adrian Greeve, Andrew Nicols, Eloy Lafuente (stronk7), Juan Leyva, Jun Pataleta, Sander Bangma, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              11 Vote for this issue
              Watchers:
              21 Start watching this issue

                Dates

                Created:
                Updated: