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

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

XMLWordPrintable

    • MOODLE_36_STABLE
    • MOODLE_35_STABLE, MOODLE_36_STABLE
    •  wip-MDL-65220-master
    • Hide

      Unfortunately this situation is very difficult to reproduce. Instead of trying to reproduce the problem, running a complete regression check of all Behat tests on the CI server should be sufficient to check it is not broken.

      Show
      Unfortunately this situation is very difficult to reproduce. Instead of trying to reproduce the problem, running a complete regression check of all Behat tests on the CI server should be sufficient to check it is not broken.

      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.

            jp76 Jason Platts
            jp76 Jason Platts
            Sam Marshall Sam Marshall
            David Monllaó David Monllaó
            CiBoT CiBoT
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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