Hi, I work for Salesforce and I recently came acro...
# http4k
g
Hi, I work for Salesforce and I recently came across this amazing toolkit and wish to use http4k to build a companion for our Functional Tests. I am looking for help to discuss my idea and understand if http4k is the right fit for my use-cases and idiomatic ways to achieve it. Please excuse this lengthy post. Ours is a REST service that takes JSON input. The steps in a typical Functional test are: 1. Start the server (This is common for all tests) 2. Setup user permissions 3. Create test data in the DB 4. Build JSON programmatically with: - Ids of DB entries created in 3 - Some specific values for the test - Some default values 5. Call API through a
ConnectClient
(written contextually for our services, which internally uses apache commons-httpclient). 6. Unmarshall response programmatically 7. Validate Now I attempt to simplify this process for 3,4,5,6,7 by outsourcing them to a library I wanna build. The idea is: 3,4 - The developer provides a JSON file with some variables (similar to Postman variables) and I wish to create test data reading them. I am planning to use lens to read and validate this input JSON for type-safety. 5 - I want to reuse our existing
ConnectClient
. How can I integrate this with http4k? (like
JavaHttpClient
)
6 - I want to use Lens again to validate response for type-safety or unmarshal to a POJO. 7 - The developer wants to assert it against a JSON resource. Is there something like
JsonApprovalTest
which doesn’t need a test runner? He also wants to assert individual field values. Is there any tool from the http4k toolkit that can help?
Also if I am missing any awesome http4k tool which can help in this flow, please let me know. Thanks!