• MOODLE_405_STABLE
    • MOODLE_405_STABLE
    • Hide

      Information

      The custom PHPUnit test suite used later in the testing instructions has been created with the following command. Putting it here for future reference. Just replace HEAD with any commit and it will generate the test suite for you.

      echo '<testsuite name="MDL-xxxx">' && \
          git show --pretty="" --name-only HEAD | \
              grep "/tests/.*_test.php" | \
              xargs -I{} echo "  <file>{}</file>" && \
          echo "</testsuite>"
      

      Running tests

      1. Init PHPUnit (php admin/tool/phpunit/cli/init.php).
      2. Edit the generated phpunit.xml
      3. Immediately after the <testsuites> line paste the contents of the attached custom_testsuite.txt file, that has been generated with the information above.
      4. Verify that the number of files in the custom testsuite matches the number of test files modified by the patch (right now, 53).
      5. Ensure that you have PCOV or XDEBUG installed and enabled in your site.
      6. Run the following phpunit command (note it can take really long):

        vendor/bin/phpunit -v --coverage-html /tmp/cc --testsuite MDL-xxxx
        

      7. Verify the the first lines of the execution confirm that you're using PCOV or XDEBUG for coverage calculations. If that's missing it means that none of them are available.
      8. Verify that there isn't any "covers warning" once the test ends. Note that there can be skipped tests, and also failed tests, but the important detail here is that, when running the test with code-coverage enabled, there aren't warnings any more.
      9. Verify that in the /tmp/cc directory has contents and that, if you open the index.html file in you browser you can see and navigate over coverage results.
      Show
      Information The custom PHPUnit test suite used later in the testing instructions has been created with the following command. Putting it here for future reference. Just replace HEAD with any commit and it will generate the test suite for you. echo '<testsuite name="MDL-xxxx">' && \ git show --pretty="" --name-only HEAD | \ grep "/tests/.*_test.php" | \ xargs -I{} echo " <file>{}</file>" && \ echo "</testsuite>" Running tests Init PHPUnit ( php admin/tool/phpunit/cli/init.php ). Edit the generated phpunit.xml Immediately after the <testsuites> line paste the contents of the attached custom_testsuite.txt file, that has been generated with the information above. Verify that the number of files in the custom testsuite matches the number of test files modified by the patch (right now, 53). Ensure that you have PCOV or XDEBUG installed and enabled in your site. Run the following phpunit command (note it can take really long): vendor/bin/phpunit -v --coverage-html /tmp/cc --testsuite MDL-xxxx Verify the the first lines of the execution confirm that you're using PCOV or XDEBUG for coverage calculations. If that's missing it means that none of them are available. Verify that there isn't any "covers warning" once the test ends. Note that there can be skipped tests, and also failed tests, but the important detail here is that, when running the test with code-coverage enabled, there aren't warnings any more. Verify that in the /tmp/cc directory has contents and that, if you open the index.html file in you browser you can see and navigate over coverage results.

      As commented in the parent (MDL-82142) of this, there are a lot of incorrect coverage annotations in codebase, all them are reported as warnings when running tests with coverage options enabled. Example:

      1) core\dml_read_slave_test::test_transaction
      "@covers ::can_use_readonly" is invalid
      

      This issue (the 1st in a series) is about to, gradually go fixing all those warnings, towards clean (without warnings) runs. Of course, they also will lead to better (more accurate) code coverage information.

      The basic idea to follow is:

      • When possible, switch to simpler (and recommended) class coverage. Change from current coverage.
      • When there are multiple classes involved, try the best applying default class coverage and individual method coverage. Observing the original coverage.

      And that's it. As said, this problem will be fixed along multiple issues, because the current number of warnings is really high (653).

      Only for dev versions (4.5dev) in main branch.

        1. custom_testsuite.txt
          3 kB
          Eloy Lafuente (stronk7)
        2. MDL-82207.png
          155 kB
          Simey Lameze
        3. MDL-82207 results.txt
          21 kB
          Simey Lameze

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Angelia Dela Cruz Angelia Dela Cruz
            Simey Lameze Simey Lameze
            Simey Lameze Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days, 10 minutes
                2d 10m

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