Create Dynamic requests and create static responses for REST Mock services
I have created a REST Most service http://localhost:8080/rest/dashboard. Underneath this I have created 3 responses. All the responses are in JSON format. This is how it is ...
Resource Path: rest/dashboard
Output:
{
'var' : '123'
}
Resource Path: rest/dashboard?id=10
Output:
{
'var' : 'def'
'id':10
}
Resource Path: rest/dashboard?id=20
Output:
{
'var' : 'cat'
'id': 20
}
So when I run the Mock services and hit the URL http://localhost:8080/rest/dashboard; it is giving me
{
'var' : '123'
}
And also for http://localhost:8080/rest/dashboard?id=10 and also for http://localhost:8080/rest/dashboard?id=20; the output is keep changing as the Dispatch mode is in SEQUENCE. So I wrote a script and kept Default response as
{
'var' : '123'
}
But I am unable to get any response from the forum for writing the grrovy as well(Groovy script must return the current HTTP URL). Can someone help me with these stubs creation.
- It may like that you just run button mock service directly?
But did you run actual request by point to mock service endpoint?