Git Product home page Git Product logo

swagger_meqa's Introduction

OpenAPI Testing Meqanized

Meqa generates and runs test suites using your OpenAPI (formerly Swagger) spec in YAML. It makes REST API testing easy by generating useful test patterns - no coding needed.

Demo

gif

Highlights

  • Understands the object relationships and generates tests that use the right objects and values.
  • Uses the description fields in the OpenAPI spec to understand the spec better and further improve accuracy.
  • Verifies the REST call results against known objects and values.
  • Verifies the REST call results against OpenAPI schema.
  • Produces easy to understand and easy to modify intermediate files for customization.

Getting Started

The compiled binaries for Linux, Windows and MacOS are under releases. You can also docker pull meqa/go:latest. In the examples below we use the classic [petstore example spec] (http://petstore.swagger.io/).

There are two steps.

  • Use your OpenAPI spec (e.g., petstore.yml) to generate the test plan files.
  • Pick a test plan file to run.

The commands are:

  • mqgo generate -d /testdata/ -s /testdata/petstore.yml
  • mqgo run -d /testdata/ -s /testdata/petstore_meqa.yml -p /testdata/path.yml

The run step uses petstore_meqa.yml, which is a tagged version of the original petstore.yml.

  • Search for meqa in petstore_meqa.yml to see all the tags.
  • The tags will be more accurate if the OpenAPI spec is more structured (e.g. using #definitions instead of inline Objects) and has more descriptions.
  • See meqa Format for the meaning of tags and adjust them if a tag is wrong.
  • If you add or override the meqa tags, you can feed the tagged yaml file into the "mqgo generate" function again to create new test suites.

The run step takes a generated test plan file (path.yml in the above example).

  • simple.yml just exercises a few simple APIs to expose obvious issues, such as lack of api keys.
  • path.yml exercises CRUD patterns grouped by the REST path.
  • object.yml tries to create an object, then exercises the endpoints that needs the object as an input.
  • The above are just the starting point as proof of concept. We will add more test patterns if there are enough interest.
  • The test yaml files can be edited to add in your own test suites. We allow overriding global, test suite and test parameters, as well as chaining output to input parameters. See meqa format for more details.

Docs

For more details see the docs directory.

swagger_meqa's People

Contributors

adityavallabh avatar earth2marsh avatar yingxie3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swagger_meqa's Issues

The generate yaml file is gives Error: unexpected end of JSON input

Here are the commands which I used to generate testcases

./mqgo_linux_amd64 generate -d ./meqa_data -s index_build2.json
./mqgo_linux_amd64 generate -d ./meqa_data -s index_build2.yaml
./mqgo_linux_amd64 generate -d ./meqa_data -s index_build2.yml

still get the same error as

got an err:
unexpected end of JSON input

Maintenance: Is this project being maintained?

Trying to run the tool with this Swagger file:

https://github.com/OpenBankingUK/payment-initiation-api-spec/blob/master/dist/v1.1/payment-initiation-swagger.yaml

$ wget https://raw.githubusercontent.com/OpenBankingUK/payment-initiation-api-spec/master/dist/v1.1/payment-initiation-swagger.yaml > petstore.yml
$ docker run -it -v $(pwd):/testdata meqa/tag mqtag -i /testdata/petstore.yml -o /testdata/petstore_meqa.yml
loaded  /testdata/petstore.yml
Traceback (most recent call last):
  File "/usr/local/bin/mqtag", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/tag.py", line 578, in main
    swagger.gather_words()
  File "/usr/local/lib/python3.6/site-packages/tag.py", line 550, in gather_words
    for name, obj in self.doc['definitions'].items():
  File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/comments.py", line 702, in __getitem__
    return ordereddict.__getitem__(self, key)

It seems to fail.

Is https://api.meqa.io/ unavailable?

Hello, I get ERR_CONNECTION_TIMED_OUT when try to open https://api.meqa.io/.
Is this site unavailable?

image

Also, I get error with message "got an err: unexpected and of JSON input" when I try to execute the script

./mqgo_windows_amd64.exe generate -d ./ -s ./swagger.yaml

I use exe file from the last release version of mqgo_windows_amd64.zip. swagger.yaml is petstore swagger specification, so I believe there is no error on my side.

Could you answer is this project still working?

Running everything locally with Docker fails

I try to generate the test data from the Open API spec file /static/api/api_v1.yml like described in the docs (run everything locally with Docker). The first command execution seems to be ok (I ignored the UdevQt stuff...). But during the second command execution it fails.

❯ docker run --rm -v $PWD/testdata:/testdata -v $PWD/static/api:/static/api meqa/tag mqtag -i /static/api/api_v1.yml -o /testdata/api_v1_meqa.yml
Failed to load file /static/api/api_v1.yml
UdevQt: unhandled device action "move"
❯ docker run --rm -v $PWD/testdata:/testdata meqa/go mqgen -d /testdata -s /testdata/api_v1_meqa.yml 
2018/03/13 15:13:52.068075 parser.go:147: invalid yaml in file /testdata/api_v1_meqa.yml types don't match expect map key string or int got: bool
2018/03/13 15:13:52.068148 main.go:60: Error: types don't match expect map key string or int got: bool
UdevQt: unhandled device action "move"

The file /static/api/api_v1.yml is valid Open API v2.0. What could be the root cause for this?

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.