-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Add auto-generated test files #2276
Comments
I don't quite understand: What is the purpose of those generated tests? But then what is being tested here? The getters/setters of the model objects? (That kind of test, if deemed necessary, should also be generated. Though I would (as a codegen-user, not as a maintainer of codegen) prefer if the generated code just works and I don't have to test it myself.) What might be useful would be a test of the actual API methods (which is to be run from a test framework against an actual server) – generating some template as a start for your own written tests. |
The purpose is to save developer's time in creating those test files from scratch. (I'll remove "don't edit this file" in my next PR) And yes, ideally we should test getter/setter for each model. The work I've done is just a starting point. Ideally the test fils should leverage all available information provided in the spec to generate all possible test cases. In my opinion, generating the test code makes the SDK/API client looks more mature. For example, if there are 2 open-source Ruby SDKs for Twitter API - one with test cases and another without any, I would tend to think the one with test cases is more mature. What do you think? There are scaffolded test cases for API methods, e.g. https://github.com/swagger-api/swagger-codegen/blob/master/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs. Is that what you're looking for? Thanks again for the feedback. I think what I'll do is to update the wording to elaborate more on the purpose of the scaffolded test cases in the auto-generated test files. |
@ePaul does it make sense to you? Later if anyone from the community has cycle, we can update codegen to automatically generate test cases specified by vendor extension in the endpoint definition. |
@wing328 Thanks, this way it is clearer. |
Hi, I want to contribute javascript related test code. And I also want to add some feature after driven down the core if I find something can make improvement. If I choose JS, all the pr will commit to this reps? |
@waiterZen that's a separate project. You can refer to the PRs above to get a better understanding of what the change (adding auto-generated test files) looks like |
in java/retrofit2 there is sufficient functionality in |
Definitely. Please kindly file a PR so that we can review the enhancement. Thanks. |
@mhuisman if you need help with the PR, please reply to let us know. |
In that case please do it against branch 2.3.0 since there were some changes in the API. |
As part of #1921, we've add capabilities to generate test files for API and model files.
If anyone has cycle to add the feature to the following languages, please reply to let us know:
Keywords: unit tests, integration tests
The text was updated successfully, but these errors were encountered: