I am facing an issue where if I am changing my 1st request to POST/GET then all other request is turn by same.
So I have created a new project for all of my GET request.
Can now using groovy, can I run any testcase or teststep?
I am testing for Rest API
I am using below code then getting error like:-
def tCase = testRunner.testCase.testSuite.testCases["Request_for_Product_Import"]
def tStep = tCase.testSteps["Api - Chekcing_Request_Product_Import"]
TestStep.run( tCase, tStep)
java.lang.NullPointerException: Cannot get property 'testSteps' on null object error at line: 3
My this request -> "Api - Chekcing_Request_Product_Import" is present on different project
There is one more dependency my 1st groovy script is taking an data from first request and I need to pass that value to my 2nd script which is present on another project that is :- Api - Chekcing_Request_Product_Import
For that I am using below code:-
def valueFromPreviousResponse = <replace your value here>
context.testCase.testSuite.setPropertyValue('REQUEST_ID', valueFromPreviousResponse)
I have added above code in a groove file name as :- Getrequest(Please refer the image)
Then I am the value in another GET request as below:-
https://mywebsite/api/api_jobs/get_response?request_id=${#TestSuite#REQUEST_ID}
My project structure is as below image:-