Forum Discussion

jsontester's avatar
jsontester
Occasional Contributor
4 years ago

Using partitial value in a request

I want to use partitial value in my request from a earlier response. I can use tranfer property or use get data but then I get the whole value and not a part what I need in my request.   As example...
  • HimanshuTayal's avatar
    4 years ago

    jsontester : You can use below code sample, it is the implementation what richie  has suggested you

     

    import groovy.json.JsonSlurper
    
    def response = testRunner.testCase.getTestStepByName("TEST__STEP__NAME").getPropertyValue("Response")
    
    slurperRes = new JsonSlurper().parseText(response)
    def val = slurperRes.PATH__TO__VALUE
    
    def desired_Val = val.take(8)
    log.info desired_Val