Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Unit test cases in Liferay 7.4 Update 50
Hello,
We need to write test cases into Liferay 7.4 Update 50,
The module type is REST-BUILDER
Liferay generated testIntegration classes with it
Question: What is the correct way to write a unit test case in Rest Builder from below?
- test (Mock the methods)
- testIntegration (Call the REST APIs from rest-client)
We have only GET-type APIs and we are using Web content to store the content.
Questions: How can we write the test cases for GET APIs when we don't have any API to create content (Test content)?
Personally, I tend to see REST APIs as wiring, not as the place to develop (testable) business-relevant code in. And the wiring is (on the unit-test level) enough to be reviewed - automated tests - including the actual REST layer - happen on a broader level, the integration tests.
Anything that's more than wiring should be extracted out and tested separately (and then it's IMHO rather obvious how to test).
Powered by Liferay™