Manual Request
How to create a manual request ?
It is possible that your server requests operate using clients/servers that hypertest has not yet instrumented. You won't be able to record and replay requests for them. Hypertest provides a workaround for that known as manual requests. Manual request allows you to define your own server request and test them.
How to create a manual request ?
Hypertest exposes the following API to create your own manual request
name
is what uniquely identifies your manual requestresolver
contains the business logic of your server requestnormalizeInputFn
This is an optional function, purpose of this function is to tell hypertest the meaning of input args of resolver, the labels you give here will be the ones you see on the dashboard while running tests. If you dont give, you will just see the input array without any labels for argsgenerateOutputForHt
This is an optional function, purpose of this function is to remove things from the output that you dont wan't to test. It is possible that you might be returning connectionObj or something similar to that, that you don't want hypertest to test. You can usegenerateOutputForHt
to return the output that you want to test
What to choose as input ?
You can choose the input of your manual request as you wish (strings, Date, booleans, arrays, objects, numbers, bigints... etc), the only restriction is that you can't send objects having methods on them that you will call in the resolver.
Don't give something like connection obj in the input of manual request. Hypertest has no context of which library is being used and it cannot provide the appropriate obj methods in replay. If you need something from the connection obj, extract that from the connection obj while preprocessing the input and pass the extracted data to your resolver.
Please note that hypertest only tests the code that you write inside the manual request resolver, anything outside it won't be tested.
How to change your controller to use manual request ?
This example assumes you are using some kind of queue that you want to test using manual request
Last updated