here is the above screenshots.
image link is mentioned below after getting response from the server:
http://apps.nextdrive.deeccus.com:9596/dataset-images/43hrcl6gu79-c567dc73-4ffd-45ec-9c8e-422ccbbece5f/C:\\Users\\DAT-Asset-192\\Desktop\\api-image.jpg
Details:
Above screenshot is based on object repository.First api will take mobile no and country code then security code will generate.2nd api mobile no will be verified in 3rd api image will be uploaded.
when I use it through test case same problem occurs.Here is my code for image upload only:—
String endpoint = endpoint
String requestMethod=requestMethod
TestObjectProperty header1 = new TestObjectProperty(“Content-Type”, ConditionType.EQUALS, “multipart/form-data”)
//TestObjectProperty header2 = new TestObjectProperty(“Accept”, ConditionType.EQUALS, “application/json”)
ArrayList defaultHeaders = Arrays.asList(header1)
List body = new ArrayList()
FormDataBodyParameter first_name = new FormDataBodyParameter(“first_name”,first_name,“PARAM_TYPE_TEXT”)
FormDataBodyParameter last_name = new FormDataBodyParameter(“last_name”,last_name,“PARAM_TYPE_TEXT”)
FormDataBodyParameter email = new FormDataBodyParameter(“email”,email,“PARAM_TYPE_TEXT”)
FormDataBodyParameter password = new FormDataBodyParameter(“password”,password,“PARAM_TYPE_TEXT”)
FormDataBodyParameter country_code = new FormDataBodyParameter(“country_code”,country_code,“PARAM_TYPE_TEXT”)
FormDataBodyParameter mobile_number = new FormDataBodyParameter(“mobile_number”,mobile_number,“PARAM_TYPE_TEXT”)
FormDataBodyParameter device_type = new FormDataBodyParameter(“device_type”,device_type,“PARAM_TYPE_TEXT”)
FormDataBodyParameter os_ver = new FormDataBodyParameter(“os_ver”,os_ver,“PARAM_TYPE_TEXT”)
FormDataBodyParameter device_name = new FormDataBodyParameter(“device_name”,device_name,“PARAM_TYPE_TEXT”)
FormDataBodyParameter vendor_name = new FormDataBodyParameter(“vendor_name”,vendor_name,“PARAM_TYPE_TEXT”)
FormDataBodyParameter image = new FormDataBodyParameter(“image”,image,“File”)
body.add(first_name)
body.add(last_name)
body.add(email)
body.add(password)
body.add(country_code)
body.add(mobile_number)
body.add(device_type)
body.add(os_ver)
body.add(device_name)
body.add(vendor_name)
body.add(image)
HttpFormDataBodyContent bodyContent = new HttpFormDataBodyContent(body)
RequestObject ro1 = new RequestObject()
ro1.setRestUrl(endpoint)
ro1.setHttpHeaderProperties(defaultHeaders)
ro1.setRestRequestMethod(‘POST’)
ro1.setBodyContent(bodyContent)
ResponseObject respObj1 = WS.sendRequest(ro1)
println(respObj1.getResponseText())
//Verifing STATUS-CODE
code1 = respObj1.statusCode
//println(code)
And I have used the datadriven method for the above code.
I have also attached the postman screen here.
![Screenshot_4|690x326](upload://yk![Screenshot_2|690x427]