Forum Discussion

JoostDG's avatar
JoostDG
Frequent Contributor
4 years ago
Solved

How to make swagger compliance assertion url dynamic

Hi,

I have been struggling to get some grip on the swagger compliance assertion. I want to provide a dynamic url but ReadyAPI doesn't seem to cope with it in the way I would expect.

Use case: The swagger url might change over time and I don't want to adapt it in all individual swagger compliance assertions.

Current attempt:

In my project setup script I define following properties:

1) 

def swaggerENGvalidationPath = testDataPath + File.separator + "swagger" + File.separator + "ENG" + File.separator + swaggerENGversionForValidation + ".yaml"

project.setPropertyValue("swaggerENGvalidationPath", swaggerENGvalidationPath)

2)

def swaggerAPPvalidationPath = "https://onlineUrlToMyApiSwagger.yaml"
project.setPropertyValue("swaggerAPPvalidationPath", swaggerAPPvalidationPath)

 

So path 1 is pointing to a yaml file present in my project repo. In the swagger validation assertion I set the url to \${#Project#swaggerENGvalidationPath} and this works fine. 

Path 2 should point to a specific url. When I set this url directly in the swagger validation assertion it works. But when I set the swaggerAPPvalidationPath as a dynamic property in the assertion like this: ${#Project#swaggerAPPvalidationPath} it doesn't work.

I see in the log "Fri Jun 25 09:19:17 UTC 2021: ERROR: attribute is not of type `object`" and I can see the HTTP Log reading the swagger file, but the assertion always fails "Failed to load the swagger definition from [${#Project#swaggerAPPvalidationPath}]

 

With \${#Project#swaggerAPPvalidationPath} it complains like this: Illegal char <:> at index 7. I notice indeed that then it starts with C:/http... which obviously won't work.

 

I tried to also to put some escaping variants in my project property, but to no avail. Tried "https://onlineUrlToMyApiSwagger.yaml", "https:////onlineUrlToMyApiSwagger.yaml", "'https://onlineUrlToMyApiSwagger.yaml'", "\"https://onlineUrlToMyApiSwagger.yaml\"",...

 

 

  • In "Zephyr Scale Server/Data Center" cloning test plans and uploading attachments via REST API is supportet. Seems Cloud does not support it.