Abao is launched, an automated API testing tool for RAML


#1

Abao is a command-line tool for testing API documentation written in RAML format against its backend implementation. With Abao you can easily plug your API documentation into the Continous Integration system like Travis CI or Jenkins and have API documentation up-to-date, all the time. Abao uses the Mocha for judging if a particular API response is valid or if is not.

Features

  • Verify that each endpoint defined in RAML exists in service

  • Verify that each endpoint url params defined in RAML are supported in service

  • Verify that each endpoint request HTTP headers defined in RAML are supported in service

  • Verify that each endpoint request body defined in RAML is supported in service - verify by validating the JSON schema

  • Verify that each endpoint response HTTP headers defined in RAML are supported in service

  • Verify that each endpoint response body defined in RAML is supported in service - verify by validating the JSON schema


#2

AWESOME! I will have a look on it and tell as much people as possible to do the same. Thanks for letting us know. We will definitely give some feedback to you soon :wink:


#3

Hi, I have tried v 0.2.0 of abao.
But I get the following error:

$ abao src/main/raml/ping.raml http://localhost:9190/ping --hookfiles=src/test/resources/abao-ping.hooks
Found Hookfiles: src/test/resources/abao-ping.hooks
Skipping hook loading…

Error reading hook files (src/test/resources/abao-ping.hooks)

This probably means one or more of your hookfiles is invalid.
GET /ping -> 200
Message: Unexpected token =
Stack: SyntaxError: Unexpected token =
at Module._compile (module.js:439:25)
at Object.Module._extensions…js (module.js:474:10)
at Object.require.extensions.(anonymous function) (C:\Users\a11632u\AppData\Roaming\npm\node_modules\abao\node_modules\proxyquire\lib\proxyquire.js:235:43)
at Module.load (C:\Users\a11632u\AppData\Roaming\npm\node_modules\coffee-script\lib\coffee-script\register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at Proxyquire._withoutCache (C:\Users\a11632u\AppData\Roaming\npm\node_modules\abao\node_modules\proxyquire\lib\proxyquire.js:169:12)
at Proxyquire.load (C:\Users\a11632u\AppData\Roaming\npm\node_modules\abao\node_modules\proxyquire\lib\proxyquire.js:131:15)
at addHooks (C:\Users\a11632u\AppData\Roaming\npm\node_modules\abao\lib\add-hooks.js:25:23)
at C:\Users\a11632u\AppData\Roaming\npm\node_modules\abao\lib\abao.js:42:11
at fn (C:\Users\a11632u\AppData\Roaming\npm\node_modules\abao\node_modules\async\lib\async.js:641:34)
at Object._onImmediate (C:\Users\a11632u\AppData\Roaming\npm\node_modules\abao\node_modules\async\lib\async.js:557:34)
at processImmediate [as _immediateCallback] (timers.js:345:15)

1) Validate response code only

1 failing

C:\projects\api\api-forsikring\forsikring-api\src\test\resources\abao-ping.hooks:1
(exports, require, module, __filename, __dirname) { {before, after} = require

My hooks file looks like this:
{before, after} = require ‘hooks’

before ‘GET /ping -> 200’, (test, done) ->
test.request.query =
color: 'red’
done()

after ‘GET /ping -> 200’, (test, done) ->
machine = test.message.body[0]
console.log machine.name

And my raml file looks like this:
#%RAML 0.8
baseUri: http://localhost:9190/ping
title: MittpPing api
/ping:
displayName: Ping meg et svar!
get:
description: gi meg et svar
responses:
200:
body:
application/json:


#4

Great contribution!!! Many thanks Ill be testing it.


#5

Could you file a issue in Github https://github.com/cybertk/abao/issues , then we can track the issue more easier.


#6

Hi @quanlong, I’ve installed abao today by executing npm install abao in my terminal. I got no problems with the installation, but when I try to run just abao I get command not found back. Quick look into node_modules proves that it was installed since I’ve got a folder there. Anything I am missing?


#7

@christian_vogel see: https://github.com/cybertk/abao/pull/10


#8

PR has been merged, thank you!


#9

Thanks guys!


#10

Hi @quanlong - what is the status of your project? :wink:


#11

@quanlong it’s bit unclear to me, how we can test query params. For instance I’d like to fire test against multiple values to query string params and see, if API will respond always with valid response.

For instance

/myservice/posts.json?query=textsearch&page=1

#12

Hi @quanlong,

Thanks for creating this! We’re trying to use Abao to validate our API here. A couple of issues I came across:

  1. The libraries you’re using (chai2-json-schema which relies on tv4) are designed for json-schema v0.4. As far as I can tell, RAML docs and tools use json-schema 0.3. The main difference I can find is the way they use the ‘required’ keyword.

  2. We use !include for our schemas and many of the schema reference each other (using $ref). Using Abao on our RAML would end up with errors about missing schemas. I have a forked repo on github with my suggested repair and a simple test case that fails with the current version. I can post a PR if you’d like. See https://github.com/limbo/abao for the repo.


#13

It’s cool, you are welcome sent PR


#14

@quanlong: here’s the PR: https://github.com/cybertk/abao/pull/30


#15

how can we test url documentation on browser? please help !!!


#16

You can read the README first, or ask questions on gitter.


#17

i have developed api url documentation in syntax as given on raml website. now i want implement it on browser… how to do it?