Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specmatic not able to take server -url in openAPI spec as testbaseurl #1425

Open
twinkle12b opened this issue Nov 14, 2024 · 2 comments
Open
Assignees
Labels
question Further information is requested

Comments

@twinkle12b
Copy link

Description
The openapi.yaml has a base path mentioned in server url but specmatic somehow does not pick up it up on test runs. Is there a way to add this base path in specmatic.json file or through ContractTest.java file.

image

Can you please suggest how to fix this issue?

@harikrishnan83 harikrishnan83 self-assigned this Nov 14, 2024
@harikrishnan83 harikrishnan83 added the question Further information is requested label Nov 14, 2024
@harikrishnan83
Copy link
Member

harikrishnan83 commented Nov 14, 2024

hello @twinkle12b , thanks for reporting this. It is good point that Specmatic should be picking up the server URL. We have this in our backlog and should be added soon.

Meanwhile you can use below setup to pass the base path in your ContractTest.java.

System.setProperty("testBaseURL", "https://api.test.example.com/v1/pet")

The testBaseURL is an alternative for this scenario (where the URL contains certain base path in addition to host and port) where just providing host and port will not be sufficient. Hope this helps.

@twinkle12b
Copy link
Author

twinkle12b commented Nov 15, 2024

Hi @harikrishnan83 Thanks for resolving my issue. But how can I also do this for my stub server as it is also not able to detect the server url path. Also is there a system property that would help me generate log file with coverage in project directory as I could do it command-line way. Can you please help me with this ?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants