To know about Mock Server framework.
Platform Mock Server is used to test the working of agents by creating expectations for each DevOps tool. When Mock Server receives a requests it matches the request against active expectations that have been configured. Platform Mock Server is available to use in the form of jar file.
Every expectation can have 4 fields:
- Path:- URL of the expectation which agent will call for the response (String).
- Parameters:- List of additional parameters required in the URL (list of key-value Pairs).
- isResponseJson:- Whether the response is a json object or a list of json(true/false)
- Response:- Mock Response (String).
Create Expectations
How to Create Expectations:
- Create a json file and put it in mock_json folder inside INSIGHTS_HOME. One json file will be created for each DevOps tool.
- Create a list in json file using square brackets like [].
- Create expectations using four fields specified above.
- Sample expectation looks like:-
{
"path": "/rally/release",
"parameters": {
"workspace" : "",
"fetch" : "true?pagesize=20",
"start" : "1"
},
"isResponseJson": true,
"response": []
}
5. Remember response will always return list.
- If isResponseJson field is set to true then response will contain only one json object in the list.
- If isResponseJson field is set to false then response can contain multiple json objects in the list.
- isResponseJson is set to false by default.
Back to Top