cancel
Showing results for 
Search instead for 
Did you mean: 

How to make swagger compliance assertion url dynamic

SOLVED
JoostDG
Frequent Contributor

Re: How to make swagger compliance assertion url dynamic

Hi @nmrao ,

Sorry for the delay. I tried that in linux:

Swagger Compliance testing failed [java.lang.IllegalArgumentException: input "#" is not an absolute JSON Reference]

nmrao
Community Hero

Re: How to make swagger compliance assertion url dynamic

@JoostDG 

Here is an approach which you can try.

NOTE:

1. In the Swagger Compliance Assertion set a file path or url (absolute value). The value will be replaced with value passed at run time as project property, SWAGGER_URL

2. Here, property expansion is not used. Instead value is overridden run time.

3. Please follow the comments provided in the script.

4. This is project setup script only.

 

Project Setup Script 

Here is the log message when the script is run

nmrao_0-1625569882099.png

 

 



Regards,
Rao.

View solution in original post

nmrao
Community Hero

Re: How to make swagger compliance assertion url dynamic

NOTE that haven't tested with actual validation.


Regards,
Rao.
JoostDG
Frequent Contributor

Re: How to make swagger compliance assertion url dynamic

Thanks Rao. Your solution seems to work on Windows just fine. Only thing is that I had to tweak a bit as I have various swagger files for various api's in my projects, so not all should point to the same swagger file, but I managed to get around that.

 

Tomorrow I can let you know whether the nightly scheduled tests also could cope with it on Linux.

nmrao
Community Hero

Re: How to make swagger compliance assertion url dynamic

It works on Linux too as I use it and you confirmed on windows.
Of course gave solution in different way. If the solution works for one url, it works for others too.



Regards,
Rao.
nmrao
Community Hero

Re: How to make swagger compliance assertion url dynamic

Incase of multiple URLs, one needs to take care for filtering the test steps that needs to be updated.

If there is some common pattern between url and test step name, then it is easy to apply filter and update url.


Regards,
Rao.
JoostDG
Frequent Contributor

Re: How to make swagger compliance assertion url dynamic

Yes! Indeed, nicely done @nmrao  !  Accepted as solution your above post.

nmrao
Community Hero

Re: How to make swagger compliance assertion url dynamic

Glad to know that you could proceed with what you needed.


Regards,
Rao.
nmrao
Community Hero

Re: How to make swagger compliance assertion url dynamic

@JoostDG,
I can see two solution to this question.
Do you want to keep your initial solution as "Accepted solution"?
Just to avoid confusion.


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors