Git Product home page Git Product logo

Comments (5)

noahdietz avatar noahdietz commented on July 28, 2024

Hi @Hiral-Dadhaniya thanks for using oatts and opening an issue.

oatts uses a rest testing framework called chakram to execute requests and assert on responses. If you take a look at your generated code, you'll notice a return chakram.wait() inside the callback for every it clause. As described here, this is returning a promise for mocha to wait for.

In this scenario it looks like the test timeout used is 2000ms (the default), and the test is being preempted. A couple of possible scenarios might be that the request is taking longer than the allotted timeout to complete, somehow the server is not reachable but the client's timeout for this is longer than the test's timeout, or there could even be an issue with how mocha is attempting to resolve the promise (i believe this would be out of the scope of this code base and we'd need to dig deeper to prove it).

I'd ask you to please raise the timeout by running the tests with a --timeout flag, and to ensure that the server you are targeting in the tests is reachable from the machine you are running the tests on (server is available on the host/port, firewalls aren't blocking, etc.)

Thank you!

from oatts.

Hiral-Dadhaniya avatar Hiral-Dadhaniya commented on July 28, 2024

Hi @noahdietz thank you for quick response.
Yeh, looks like timeout issue. It works with --timeout flag. I was under impression oatts may use own rules to validate json/yaml files, but I think as you mentioned it's the chakram for executing requests and doing assert. So, is it possible to have own rules to validate json/yaml or .js(As it creates the JS files).

from oatts.

noahdietz avatar noahdietz commented on July 28, 2024

OK glad the timeout flag helped.

If I understand the question, you want to know how oatts validates the JS files it creates? Or the spec that it consumes? Or are you asking about the assertions done on the response as part of the tests that are run? Not sure I am following the question can you please explain in more detail? Thanks.

from oatts.

Hiral-Dadhaniya avatar Hiral-Dadhaniya commented on July 28, 2024

Yes, Sure.
Basically i am interested in how Oatts validates spec that it consumes. But as it creates JS out of it and validates using chakram, am not sure specific validations of spec file for edit/update supported. (For example: json structure, schema(These two i think chakram itself does?), specific rules like 'parameter objects should have a description' or 'no comma in description' etc. ) Correct me if i am wrong

from oatts.

noahdietz avatar noahdietz commented on July 28, 2024

oatts uses a module called sway to consume & traverse the given specification. sway also validates the schema of the given OAS document, ensuring it conforms. However this is not the goal of oatts. oatts is meant to generate a test suite (of JS files) that would test the contract validity between the OAS document and the server that implements the API. It does not validate the schema of the specification specifically as a test.

I am going to close this issue as we have resolved the issue. Thanks!

from oatts.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.