lundi 9 novembre 2020

Testing basex with unit module

I am planning testing of my Basex application using a standard Basex unit module. I have several doubts how to do it in the most efficient way.

  1. How to test functions which update data in Basex DB? One idea is to use %unit:before-module and temporarily change some lines in the file with DB configuration. For example my app's config.xqm contains the line declare variable $config:my-db-name := "mydatabase";. I may change this to declare variable $config:my-db-name := "mytestdatabase"; in %unit:before-module and initialize this test database with data I need.

  2. Mocking some invocations (data scrapping from external sources): again I suppose the only way is to change appropriate functions within modules within %unit:before-module. Not a nice solution thought.

  3. Is there any way to reuse definitions between unit test modules? 'import module namespace' seems to be working only for repo modules. Should test modules be placed in repo as well?

  4. How about testing webapp modules? Is this possible with Basex unit module? I would not like to configure a separate heavy testing framework here.

BR

Aucun commentaire:

Enregistrer un commentaire