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

getting unable to resolve a value after 10000 tries. #245

Closed
arjunashetty opened this issue Oct 13, 2022 · 9 comments
Closed

getting unable to resolve a value after 10000 tries. #245

arjunashetty opened this issue Oct 13, 2022 · 9 comments

Comments

@arjunashetty
Copy link

Hi Team,

I am getting following error for all the testcases when i run : mvn tcases:api-test

swagger doc : swagger-petstore-api

Error :
RequestCaseDef[12,Body.application-json.Items.Contains.Value.Properties.id.Type=null,POST,/user/createWithList,FAILURE],requestBody,value,unique item[2] of 13: Unable to resolve a value after 10000 tries. No request case created for this test.

@arjunashetty arjunashetty changed the title getting getting unable to resolve a value after 10000 tries. Oct 13, 2022
@kerrykimbrough
Copy link
Contributor

Please send a copy of the OpenAPI document I can use to reproduce this. Also send the name of the file and the command that you are running. Also, if you have changed the configuration of the tcases-maven-plugin, send a copy of the pom.xml that defines this configuration.

@arjunashetty
Copy link
Author

The swagger-petstore open api is kept in this location :
image

attached the openapi.json file, which is default open api spec from swagger(pet-store):

command used : mvn tcases:api-test
openapi.zip

@arjunashetty
Copy link
Author

@kerrykimbrough can you please update

@kerrykimbrough
Copy link
Contributor

I am able to reproduce this symptom, and I am investigating the cause.

This test case is a complicated situation where TFOA has some limitations. As described by the log message, this is a test case for a POST /user/createWithList request in which the body must contain an array of unique object items, one of which must have an id: null property (an invalid value expected to cause a FAILURE). The trouble arrises when TFOA tries to "resolve" these requirements into actual values.

The only info available for resolution is the definition generated by Tcases for this test case. It specifies that the array must contain multiple unique items and that one of them must have id: null. But there is not enough information available to derive values for the other array items. It specifies that they must be object values, but the complete object model is not included. TFOA can only try random objects with random properties, which of course are very unlikely to match the OpenAPI definition of this request.

You will notice that the log shows several other instances of this kind of resolution failure. For some of them, it may be possible to extend the test case with more info for resolution. But for the specific case you reported, this approach won't work -- the info needed to describe an arbitrarily complex object value is just too unbounded.

@arjunashetty
Copy link
Author

but this API specification is default specification provided by swagger, and Tcases didnt create tests for any of the APIs mentiioned.

@kerrykimbrough
Copy link
Contributor

I don't understand your last comment. My results show that many test cases were generated for each of the API requests defined in this OpenAPI definition, including tests for POST /user/createWithList. In fact, of the 142 test cases generated, only 22 were skipped because of a resolution failure.

Nevertheless, the 22 skipped tests are definitely an issue that I am investigating.

@kerrykimbrough
Copy link
Contributor

I've found an improvement that eliminates these resolution failures. Look for a new release soon.

@arjunashetty
Copy link
Author

Thank you @kerrykimbrough

@kerrykimbrough
Copy link
Contributor

Fixed by PR #246

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