1

I have feature file A(User Import) which runs in Asynchronous method and I want to run another feature i.e CleanUp Api only after the status in feature A shows Success.. Feature A shows In-Progress status till all the users imported. Success status will appear only after all the users imported. I want to run my Cleanup API which is Feature B only after this Success response in Feature A. CODE:

Feature: User import

Background:

  • url baseURL

  • header Content-Type = 'application/json'

  • header Authorization = custToken.token

  • def dev = call read('DG2Retrieve Device Groups of a Customer.feature')

  • def deviceGroupId1 = dev.response.listGetAllDeviceGroup[0].deviceGroupId

  • def deviceGroupId2 = dev.response.listGetAllDeviceGroup[1].deviceGroupId

  • def deviceGroupId3 =dev.response.listGetAllDeviceGroup[2].deviceGroupId

  • def deviceGroupId4 = dev.response.listGetAllDeviceGroup[3].deviceGroupId

Scenario: User importing

Given path '/v1/uploadusercsvfile'

And header Content-Type = 'multipart/form-data'

And multipart file file = { read: '../com.zerv.testdata/userData.csv',filename: 'userData.csv', contentType: 'multipart/form-data'}

And form field userDeviceAndGroupData = {"listDeviceGroupIds" : ['#(deviceGroupId1)','#(deviceGroupId2)','#(deviceGroupId3)','#(deviceGroupId4)']

When method POST

Then status 200

And match response.status == "success"

And print response


The above code is for User Importing and Add deviceGroups to that Users in Asynchronous method. When I run clean up Api i.e feature B without getting Success response the device groups are deleted. So I want to run my CleanUp feature only after I get Success response in Feature A(i.e. User Import)

  • please read the linked q & a - it should answer all your questions. if you still need help, ask a new question with what exactly you tried and kindly keep it simple | also note this is what we recommend for "clean up" flows: https://stackoverflow.com/a/60944060/143475 – Peter Thomas Dec 01 '21 at 08:21

0 Answers0