mocking framework and how to setup it on local iris
Hi All,
I am writing few test for REST API need help from you guys as I am new to Objectscript. I want to implement mocking into testcase but didn't get any good resource for the same. please help me
You can take a look to this article and the associated Open Exchange application: https://community.intersystems.com/post/creating-rest-service-iris
It is not what i want. I am writing unit test cases and Also I have tested APIs from Postman but for Unit testing we need to write Unit testcases.
Your would use JMeter to launch multiple calls in a row.
I'm sure that the best way to test REST API would be to use some external tools, such as Postman/newman
You can look at my example project, which contains running tests against REST using newman
But it also contains some tests for REST on the IRIS side
Calling @Timothy Leavitt as Tim has a lot experience in Mocking. There is also a lib Forgery on OEX by @Rubens Silva that is related.
If you want mock ObjectScript classes use this :
https://github.com/GendronAC/InterSystems-UnitTest-Mocking
I had used it, it work quiet well.
Hi @Guillaume Rongier
I was also looking the same repository. Try to install it by using ZPM. But it was giving error below -
ERROR! 'mocking-framework' not found in any repository.
any article how to setup this framework in my existing project on a local iris server.
What I have done on one project, is to copy past the code and use it.
I haven't used ZPM.
Here is an example : https://github.com/grongierisc/RestToDicom
How you are running the testcases. I tries to copy the Fw dir to my project but it is not working.
I am getting this error while compiling few files.
ERROR #5373: Class 'EnsLib.HL7.Message', used by 'TEST.Fw.CUnitTestBase:GetHL7FromString:ReturnType', does not exist
> ERROR #5030: An error occurred while compiling class 'TEST.Fw.CUnitTestBase'
ERROR #5373: Class 'EnsLib.HL7.Message', used by 'TEST.Fw.CUnitTestBase:GetHL7FromXData:ReturnType', does not exist
> ERROR #5030: An error occurred while compiling class 'TEST.Fw.CUnitTestBase'
It's not published on OEX, thus is not available on the public ZPM.
Calling @AndreClaude Gendron to publish it on Open Exchange.
@Gautam Rishi , I see it contains module.xml in the root. So it is prepared to act as a ZPM module.
You probably can install it as:
USER>zpm "load https://github.com/GendronAC/InterSystems-UnitTest-Mocking"
getting this error while running the same command
ERROR! ObjectScript error: <CLASS DOES NOT EXIST>%GetClass+5^%ZPM.PackageManager.Developer.Extension.SourceControl.Interface.1 *SourceControl.Git.Extension
> ERROR #6315: Errors reporting importing XML subelement in file '/Users/irisusr/mgr/Temp/6665532401621932/InterSystems-UnitTest-Mocking/module.xml' at line '3' offset '42', skipping this item.
Maybe try again after using InterSystems Portal to change the Source Control Class setting for the namespace to "NONE".
mocking-framework] Reload START (/Users/irisusr/mgr/Temp/6665534996923997/InterSystems-UnitTest-Mocking/)
[mocking-framework] Reload FAILURE
ERROR! Resource path '/Users/irisusr/mgr/Temp/6665534996923997/InterSystems-UnitTest-Mocking/src/chs' not found
Just wanted to call people's attention to this new item in the Ideas portal:
https://ideas.intersystems.com/ideas/DPI-I-531
Please upvote if you want to see it get traction!