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

Behat: Mobile app test scenarios sometimes do not clear database data

    XMLWordPrintable

    Details

      Description

      When running tests I am creating for the new mobile App behat framework I am sometimes experiencing database data left over when starting a new scenario in the feature file.
      This tends to occur when the App steps are the last listed in the scenario.

      I haven't been able to replicate on any of the core tests such as forum - and the problem is intermittent and hard to replicate at will.

      From debugging I can see that the App is making lots of webservice requests simultaneously - this results in lots of simultaneous database updates/inserts that are running in independant PHP threads.

      \testing_util::set_table_modified_by_sql() captures all DB updates/inserts whilst the tests are running and writes the relevant table to behatrun/tablesupdatedbyscenario.json.
      I am finding issues when there are large volumes of concurrent table changes as the json file read fails (presumably as it is currently being written by another thread) and so the list of changed tables is updated with the latest change only. The result of this is that the changed tables are then not reset on starting the next scenario.

      The issue is related to multiple updates to the webservice_tokens table - looking at the code it is unnecessary to continually update the json file with an existing value so I propose testing for this before making the write.

        Attachments

          Activity

            People

            • Assignee:
              jp76 Jason Platts
              Reporter:
              jp76 Jason Platts
              Peer reviewer:
              Sam Marshall
              Integrator:
              David Monllaó
              Tester:
              CiBoT
              Participants:
              Component watchers:
              Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/May/19

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m