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

[Junit] Too many constraints error #168

Closed
codingsoo opened this issue Apr 20, 2021 · 12 comments
Closed

[Junit] Too many constraints error #168

codingsoo opened this issue Apr 20, 2021 · 12 comments

Comments

@codingsoo
Copy link

Hi,

When a swagger file is big, it generates too many constraints error.

I think this is because Junit has limited constraints pool. I tried this project: https://github.com/devgateway/ocvn

@codingsoo
Copy link
Author

codingsoo commented May 3, 2021

To solve this problem, I think the number of Junit tests should be limited or the test files should be splitted.

@kerrykimbrough
Copy link
Contributor

Sorry, I don't understand what you mean by "too many constraints error". Can you explain? Better yet, can you show a reproducible test case?

@codingsoo
Copy link
Author

codingsoo commented May 14, 2021

tcases_ocvn.zip
Hi, thank you for reply.

The constant pool includes numbers, strings, method names, field names, class names, references to classes and methods. The limit is 65536, so it needs to be split when it exceeds it. I attached the file which is generated by Tcases for the OCVN REST API web service.

  • timeout was added by me.

@kerrykimbrough
Copy link
Contributor

The best solution is to control the size of the generated test by controlling the amount of the API that is covered. For example, you might consider generating separate tests for each API path.

# Generate tests only for operations on /myResource
tcases-api-test -P /myResource myApiSpec.json

Or if using Maven:

# Generate tests only for operations on /myResource
mvn tcases:api-test -Dpaths=/myResource -Dproject=myApiSpec

@codingsoo
Copy link
Author

codingsoo commented May 15, 2021

Hi,

First of all, thank you for your proposed solution. While I agree with you that exercising each API path should work, unfortunately there are too many end-points in the swagger file (https://github.com/codingsoo/temp_swagger/blob/main/ocvn.json), which would make the proposed solution not suitable for my case.

Would it be possible to add a feature for exercising a fat swagger file's every API path? I would greatly appreciate any help regarding this issue. Thank you very much for all the help!

@kerrykimbrough
Copy link
Contributor

I'm considering adding an option to automatically generate a separate test class for each API path. Would that resolve your problem?

@codingsoo
Copy link
Author

Sure! I really appreciate it!

@kerrykimbrough
Copy link
Contributor

@codingsoo, unless you have any further requests, I plan to produce a new release containing the 2 new features you suggested.

@codingsoo
Copy link
Author

Thank you very much! I really like this project.

@kerrykimbrough
Copy link
Contributor

Fixed by PR #173

@kerrykimbrough
Copy link
Contributor

@codingsoo, FYI, a new release 3.6.0 containing your suggested features is now available

@codingsoo
Copy link
Author

I will use 3.6.0! Thank you very much:) Hope you have a wonderful day.

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

No branches or pull requests

2 participants