data-factory-testing-framework icon indicating copy to clipboard operation
data-factory-testing-framework copied to clipboard

Overriding expression functions

Open MarvinSchenkel opened this issue 8 months ago • 4 comments

Hi there 👋,

I would love to mock the implementation of the utcNow() function to make my tests deterministic.

Reading the docs, it should be possible via FunctionRepository.register. However, I am getting the error "type[FunctionsRepository]" has no attribute "register", which kinda makes sense because this class does not have a function called register. Searching this repository also does not yield any other results regarding this functionality.

Am I missing something?

MarvinSchenkel avatar May 08 '25 07:05 MarvinSchenkel

Hi @MarvinSchenkel,

Thanks for reporting!

That makes a lot of sense and used to be possible with the FunctionRepository.register function. However, since we changed the framework's approach from a pure python implementation to leveraging the logic apps expression runtime nuget package, this is not possible anymore.

I think this is an important feature to have, let me get back to you later!

arjendev avatar May 08 '25 07:05 arjendev

@MarvinSchenkel, we figured out a way how to mock the non-deterministic functions like utcnow and guid. @jayachithra and @LeonardHd are working on implementing it.

arjendev avatar May 09 '25 09:05 arjendev

Great news! Thanks for the update

MarvinSchenkel avatar May 12 '25 07:05 MarvinSchenkel

Hi @MarvinSchenkel,

I just wanted to share that we are still working on the mocking capabilities. We need to release another version of the underlying evaluation engine and make sure that the mocking API has a somewhat coherent, easy to use, and extensible API. We will update this issue once we have enough confidence to release the mocking capabilities.

LeonardHd avatar Jun 23 '25 15:06 LeonardHd