Skip to content

issue #1948, added testing code to test go api #2532

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

Merged
merged 4 commits into from
Apr 10, 2016

Conversation

guohuang
Copy link
Contributor

@guohuang guohuang commented Apr 8, 2016

#1948

@wing328 i don't know if this is what you want, it is very similar to the test.go, please take a look
the swagger.io api http://petstore.swagger.io/v2/pets does not return anything which causing the tests failed.

here is the test result
image

@wing328
Copy link
Contributor

wing328 commented Apr 9, 2016

@guohuang thanks for the PR. I think that's better than what we currently have.

To make it even better, I would suggest using assert from https://github.com/stretchr/testify to verify the response.

For other languages (e.g. Ruby), we do check each field from the returned object, e.g. https://github.com/swagger-api/swagger-codegen/blob/master/samples/client/petstore/ruby/spec/pet_spec.rb#L73

@wing328 wing328 added this to the v2.2.0 milestone Apr 9, 2016
@guohuang
Copy link
Contributor Author

@wing328 thanks for your suggestion, i have added assert function, however, since the endpoints are failing to return anything, i could not test it.

btw, do you expect me to write similar tests for the store and user api as well?

@wing328
Copy link
Contributor

wing328 commented Apr 10, 2016

@guohuang thanks for the quick turnaround. Let me have a look at the Petstore test later today.

I do not expect you to do so. Later we can add more test cases if needed. Your work is a good reference that other Go contributors can easily follow.

@wing328
Copy link
Contributor

wing328 commented Apr 10, 2016

@guohuang btw, your commit (1f39a4d) is not linked to your Github account somehow ...

@wing328 wing328 merged commit 4942ebd into swagger-api:master Apr 10, 2016
@wing328
Copy link
Contributor

wing328 commented Apr 10, 2016

The issue with the failed test cases is related to the spec and it's addressed in #2542 (merged into master).

Please pull the latest master when you've a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants