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

Rework useragent tests to improve coverage

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.7.4, 2.8, 2.9
    • Fix Version/s: 2.7.5, 2.8.3
    • Component/s: Unit tests
    • Labels:

      Description

      At present the useragent_test_testcase is basically written as a set of user agents in a 4-dimensional array (Browser => Version => OS => Agent), and a set of tests which then test against those.

      This sucks for several reasons:

      1. We have one big long function which is difficult to read, and difficult to extract fail information from;
      2. We do not adequately test all scenarios (e.g. we do not check that Opera is not picked up as Chrome, or that IE6 is not picked up as any other browser) so we miss coverage;
      3. we have potential to miss tests far too easily (we can have items defined in the list of agents which have no tests against them - e.g. MSIE 5.5); and
      4. the information about expected false positives and obscure results can be placed in two locations depending on the test author.

      We can easily fix this by rewriting this as a data provider (using the dataProvider function_name phpdoc syntax) which returns an array of useragents and expected test results.

        Attachments

          Activity

            People

            Assignee:
            dobedobedoh Andrew Nicols
            Reporter:
            dobedobedoh Andrew Nicols
            Peer reviewer:
            Rajesh Taneja
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Zachary Durber
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              2/Feb/15