Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-62650

Allow supplying test database to LocalStorage



    • Type: Suggestion
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:


      There's currently no good way to supply test data to LocalStorage for Unit Tests:

      As LocalStorage can't open certain database files but only databases with a given name lying around at the QtQmlEngines offlineStoragePath, it is currently not possible to open a given database including test data (my usecase: testing a database migration).

      Currently the only options to open a certain database are:

      1. MD5-hashing the wanted database name, name the database & ini files that way (AFAIK this isn't stable API, though)
      2. determine the offlineStoragePath of the application & put the files there or change the path with QQmlEngine::setOfflineStoragePath{{}}

      This is neither convenient nor easy to do, furthermore changing QQmlEngine attributes is hard when using the QUICK_TEST_MAIN testrunner harnisch macro.


      If there shall be no support in LocalStorage itself for opening certain files, support for supplying test databases should be at least available as a part of QtQuickTest.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            • Assignee:
              w00t Robin Burchell
              schmittlauch Trolli Schmittlauch
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes