Just confirm: while before-module and after-module are separate transactions, within a single unit:test function that itself performs an updating function there’s no way to then evaluate the result of the
update as any asserts will be in the same transaction.
Cheers,
E.
_____________________________________________
Eliot Kimber
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
LinkedIn | Twitter | YouTube | Facebook
From:
Eliot Kimber <eliot.kimber@servicenow.com>
Date: Tuesday, February 1, 2022 at 12:41 PM
To: Christian Grün <christian.gruen@gmail.com>
Cc: basex-talk@mailman.uni-konstanz.de <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Techniques for Unit Testing Updating Operations
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
LinkedIn | Twitter | YouTube | Facebook
From:
Christian Grün <christian.gruen@gmail.com>
Date: Tuesday, February 1, 2022 at 12:35 PM
To: Eliot Kimber <eliot.kimber@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