Functional tests using OrthancPluginService?

Hi all,

My plugin uses some OrthancPluginServices : OrthancPluginHttpClient,

OrthancPluginRestApiPut/Delete, OrthancPluginCallPeerApi or OrthancPluginGetPeers….

So in my test it, I always need the OrthancPluginContext.
If I mock this context I need to call OrthancCPlugin private methods like “CallHttpClient2” for “OrthancPluginHttpClient” service.

Is there a way to do functional tests on plugin methods using InvokeService?

Do you have some samples doing that?

I join an example of test I want to pass.
Did I do some mistake in my implementation ?

Regards.

Audrey

MyPluginRequestTest.cpp (3.28 KB)

Hi Audrey,

There are no mocks available for the Orthanc services. We do sometimes have unit tests that are testing the inner classes of a plugin (not the ones that interface with Orthanc).

Then, we have integration tests that work at the API level. Ex for the transfer plugin: https://hg.orthanc-server.com/orthanc-tests/file/tip/Plugins/Transfers/Run.py

HTH,

Alain.