I see. I guess I assumed that a module-level variable would be invariant across 
the transactions, but clearly not (and I didn’t notice the milliseconds 
difference).

With a static database value then my tests do pass.

Cheers,

E.

_____________________________________________
Eliot Kimber
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com<https://www.servicenow.com>
LinkedIn<https://www.linkedin.com/company/servicenow> | 
Twitter<https://twitter.com/servicenow> | 
YouTube<https://www.youtube.com/user/servicenowinc> | 
Facebook<https://www.facebook.com/servicenow>

From: Christian Grün <christian.gr...@gmail.com>
Date: Tuesday, February 1, 2022 at 12:35 PM
To: Eliot Kimber <eliot.kim...@servicenow.com>
Cc: basex-talk@mailman.uni-konstanz.de <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Techniques for Unit Testing Updating Operations
[External Email]


Hi Eliot,

> The database is created but is not dropped and obviously not updated.
>
> If my test is legit then this suggests that before-module and after-module 
> are not separate transactions.

As each function will be evaluated separately, the current dateTime
value will be different for each function call. Your code should work
if you replace current-dateTime() by current-date() or any other
static value.

Best,
Christian

Reply via email to