Код: Выделить всё
Background: Pre-Requisites
* def reachServicesUrl = karate.get('reachApiBaseUrl')
* def envJwtToken = Java.type('listingsmanagement.fixtures.EnvConfig')
* def jwtToken = envJwtToken.get('JWT_TOKEN')
* def triggerMarketableLocationIdToExcelWritterClass = Java.type("listingsmanagement.fixtures.MLocationCreateFileWritter")
* def writeMarketableLocationIdToExcel = triggerMarketableLocationIdToExcelWritterClass.writeMarketableLocationToExcel("src/test/java/listingsmanagement/utilities/marketable-location-to-create.xlsx", "LC001")
* java.lang.Thread.sleep(10000)
* def parsingMarketableLocationIds = Java.type("listingsmanagement.fixtures.MLocationCreateSheetParser")
* def getMarketableLocationIds = parsingMarketableLocationIds.convertExcelToJson("src/test/java/listingsmanagement/utilities/marketable-location-to-create.xlsx")
* def filepath = 'file:/Users/palanisankar/listings-management-projects/listings-management/automation/target/test-classes/listingsmanagement/utilities/marketable-location-to-create.xlsx'
@Test11
Scenario: Listing successfully created for an available marketable location
Given url reachServicesUrl
And path 'marketable-location', 'create'
And header Content-Type = 'multipart/form-data'
And cookie dev-authorization = jwtToken
* karate.log('Marketable Location Ids: ', getMarketableLocationIds)
* def fileUpload =
"""
{
"read": '#(filepath)',
"filename": "marketable-location-to-create",
"contentType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}
"""
And multipart file locationCreateFile = fileUpload
When method Post
Then status 200
* def marketableLocationIdsArray = $getMarketableLocationIds[*].['Marketable Location Id']
* print 'Marketable Location Ids Array: ', marketableLocationIdsArray
Подробнее здесь: https://stackoverflow.com/questions/795 ... -framework