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.
-
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 linedeclare variable $config:my-db-name := "mydatabase";
. I may change this todeclare variable $config:my-db-name := "mytestdatabase";
in%unit:before-module
and initialize this test database with data I need. -
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. -
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?
-
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