Skip to content

Commit

Permalink
Merge pull request #238 from cybertk/0.5.3
Browse files Browse the repository at this point in the history
v0.5.3
  • Loading branch information
plroebuck authored Apr 11, 2018
2 parents 8ac502e + 0cb0335 commit eb850ef
Show file tree
Hide file tree
Showing 46 changed files with 1,680 additions and 760 deletions.
35 changes: 35 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
###
### .editorconfig <http://editorconfig.org/>
###


## Topmost EditorConfig file
root = true

## UTF8, Unix-style newlines, newline ends every file, trim trailing whitespace
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

## Source code: 2 space indentation
[*.coffee,*.js]
indent_style = space
indent_size = 2

## RAML: 2 space indentation
[*.raml]
indent_style = space
indent_size = 2

## Config files: 2 space indentation
[*.json,*.yml,*.yaml]
indent_style = space
indent_size = 2

## Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

50 changes: 27 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
# Mac shit
###
### .gitignore
###

## Mac shit
.DS_Store

# Logfiles
logs
*.log
## Editor-related tempfiles
.*.sw[op]
*~

# Runtime data
pids
*.pid
*.seed
## Logfiles
*.log
logs/

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
## Build tool configuration files and intermediate storage
.grunt/

# Coverage directory used by tools like istanbul
coverage
# Node/npm
.node_repl_history
.npm/

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
## Package dependencies
node_modules/

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
## Coverage reports and instrumented source
.nyc_output/
coverage/
lib-cov/
lib/*.js

# Dependency directory
# Deployed apps should consider commenting this line out:
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules
## `npm pack` artifact
abao-[0-9]*.[0-9]*.[0-9]*.tgz

# Generated from CoffeeScript source
lib/*.js
tests/unit/*.js
## dotenv environment variables file
.env

18 changes: 18 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"default": true,
"header-style": { "style": "atx" },
"ul-style": { "style": "asterisk" },
"ul-indent": { "indent": 2 },
"no-multiple-blanks": { "maximum": 2 },
"line-length": { "line_length": 120 },
"commands-show-output": false,
"ol-prefix": { "style": "one" },
"hr-style": { "style": "---" },
"proper-names": {
"names": [
"CoffeeScript",
"JavaScript"
],
"code_blocks": false
}
}
39 changes: 37 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
test/
lib/*.js
###
### .npmignore
###

## Git
.gitignore

## GitHub
.github/

## CI configuration files
.codeclimate.yml
.travis.yml
wercker.yml

## Build tool configuration files and intermediate storage
.editorconfig
.grunt/
.markdownlint.json
Gruntfile.coffee
coffeelint.json

## Node/npm
.node_repl_history
.npm/

## Coverage reports and instrumented source
coverage/
lib/*.js

## Test code and fixtures
test/

## `npm pack` artifact
abao-[0-9]*.[0-9]*.[0-9]*.tgz

# dotenv environment variables file
.env

21 changes: 14 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ node_js:
- '6'
- '4'
env:
- NODE_ENV=development
- NODE_ENV=development
notifications:
slack:
secure: fsCX0/TDE9TAJR0S91dboOZ4expmCc8o6joVzsHNJYTJfDtSJehdKjTzYuO/vsRigOOoQZ0dJEPl+D4fysBDV+jkOT5sTjp/uKtcfwHwPi03K8GauwvyW0x4N1M+mY+5jN2ZyBZXqVM5dc0wbgldP9QOg5UpB80hfWUZ+0F1MTM=
Expand All @@ -26,11 +26,18 @@ deploy:
repo: cybertk/abao
after_success:
# - grunt coveralls:upload
- BUILD_DIR="$HOME/build"
- GITHUB_REPO="cybertk/abao"
- PROJ_BUILD_DIR="$BUILD_DIR/$GITHUB_REPO"
- PROJ_COVER_DIR="$PROJ_BUILD_DIR/coverage"
- COVERAGE_FILE="$PROJ_COVER_DIR/coverage.lcov"
- COVERALLS_BIN="./node_modules/coveralls/bin/coveralls.js"
- COVERAGE_FILE="$TRAVIS_BUILD_DIR/coverage/coverage.lcov"
- COVERALLS_BIN="./node_modules/.bin/coveralls"
- $COVERALLS_BIN lib < $COVERAGE_FILE; echo "exit=$?"
- echo
- echo
- echo "===== COMMIT ====="
- echo "TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG"
- echo "TRAVIS_COMMIT=$TRAVIS_COMMIT"
- echo "TRAVIS_COMMIT_MESSAGE=$TRAVIS_COMMIT_MESSAGE"
- echo "TRAVIS_TAG=$TRAVIS_TAG"
- echo "TRAVIS_BRANCH=$TRAVIS_BRANCH"
- echo "===== BUILD ====="
- echo "TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER"
- echo "TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR"

17 changes: 15 additions & 2 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = (grunt) ->

'use strict'
require('time-grunt') grunt

# Dynamically load npm tasks
Expand All @@ -10,6 +11,7 @@ module.exports = (grunt) ->
# Load in the module information
pkg: grunt.file.readJSON 'package.json'

readme: 'README.md'
gruntfile: 'Gruntfile.coffee'

clean:
Expand Down Expand Up @@ -42,15 +44,23 @@ module.exports = (grunt) ->
]

coffeelint:
options:
configFile: 'coffeelint.json'
default:
src: [
'lib/*.coffee'
'test/**/*.coffee'
]
gruntfile:
src: '<%= gruntfile %>'

markdownlint:
options:
configFile: 'coffeelint.json'
config: require './.markdownlint.json'
default:
src: [
'<%= readme %>'
]

coffeecov:
transpile:
Expand Down Expand Up @@ -84,7 +94,10 @@ module.exports = (grunt) ->
]

grunt.registerTask 'instrument', [ 'coffeecov' ]
grunt.registerTask 'lint', [ 'coffeelint' ]
grunt.registerTask 'lint', [
'coffeelint',
'markdownlint'
]

grunt.registerTask 'test', [
'lint'
Expand Down
71 changes: 39 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Automated testing tool based on RAML-0.8

# Abao

RAML-based automated testing tool

[![Build Status][Travis-Abao-badge]][Travis-Abao]
[![Dependency Status][David-AbaoDep-badge]][David-AbaoDep]
[![devDependency Status][David-AbaoDevDep-badge]][David-AbaoDevDep]
[![Dependency Status][DavidDM-AbaoDep-badge]][DavidDM-AbaoDep]
[![devDependency Status][DavidDM-AbaoDevDep-badge]][DavidDM-AbaoDevDep]
[![Coverage Status][Coveralls-Abao-badge]][Coveralls-Abao]
[![Gitter][Gitter-Abao-badge]][Gitter-Abao]
[![CII Best Practices][BestPractices-Abao-badge]][BestPractices-Abao]
Expand All @@ -20,13 +20,13 @@ is valid or not.

## Features

- Verify that each endpoint defined in RAML exists in service
- Verify that URL params for each endpoint defined in RAML are supported in service
- Verify that the required query parameters defined in RAML are supported in service
- Verify that HTTP request headers for each endpoint defined in RAML are supported in service
- Verify that HTTP request body for each endpoint defined in RAML is supported in service, via [JSONSchema][] validation
- Verify that HTTP response headers for each endpoint defined in RAML are supported in service
- Verify that HTTP response body for each endpoint defined in RAML is supported in service, via [JSONSchema][] validation
* Verify that each endpoint defined in RAML exists in service
* Verify that URL params for each endpoint defined in RAML are supported in service
* Verify that the required query parameters defined in RAML are supported in service
* Verify that HTTP request headers for each endpoint defined in RAML are supported in service
* Verify that HTTP request body for each endpoint defined in RAML is supported in service, via [JSONSchema][] validation
* Verify that HTTP response headers for each endpoint defined in RAML are supported in service
* Verify that HTTP response body for each endpoint defined in RAML is supported in service, via [JSONSchema][] validation

## RAML Support

Expand Down Expand Up @@ -93,12 +93,12 @@ the RAML. You can print a list of the generated names with the `--names` flag.

### Example

The RAML file used in the examples below can be found [here](../master/test/fixtures/single-get.raml).
The RAML file used in the examples below can be found [here](../master/test/fixtures/machines-single_get.raml).

Get Names:

```bash
$ abao single-get.raml --names
$ abao machines-single_get.raml --names
GET /machines -> 200
```

Expand All @@ -108,7 +108,7 @@ response code for each path.
```bash
$ ABAO_HOME="/path/to/node_modules/abao"
$ TEMPLATE="${ABAO_HOME}/templates/hookfile.js"
$ abao single-get.raml --generate-hooks --template="${TEMPLATE}" > test_machines_hooks.js
$ abao machines-single_get.raml --generate-hooks --template="${TEMPLATE}" > test_machines_hooks.js

```

Expand Down Expand Up @@ -155,7 +155,7 @@ after 'GET /machines -> 200', (test, done) ->
Run validation with *JavaScript* hookfile (from above):

```bash
$ abao single-get.raml --hookfiles=test_machines_hooks.js
$ abao machines-single_get.raml --hookfiles=test_machines_hooks.js
```

You can also specify what tests **Abao** should skip:
Expand Down Expand Up @@ -208,24 +208,27 @@ test 'GET /machines -> 200', (response, body, done) ->

### test.request

- `server` - Server address, provided from command line.
- `path` - API endpoint path, parsed from RAML.
- `method` - HTTP method, parsed from RAML request method (e.g., `get`).
- `params` - URI parameters, parsed from RAML request `uriParameters` [default: `{}`].
- `query` - Object containing querystring values to be appended to the `path`,parsed from RAML `queryParameters` section [default: `{}`].
- `headers` - HTTP headers, parsed from RAML `headers` [default: `{}`].
- `body` - Entity body for POST, PUT, and PATCH requests. Must be a JSON-serializable object. Parsed from RAML `example` [default: `{}`].
* `server` - Server address, provided by command line option or parsed from
RAML `baseUri`.
* `path` - API endpoint path, parsed from RAML.
* `method` - HTTP method, parsed from RAML request method (e.g., `get`).
* `params` - URI parameters, parsed from RAML request `uriParameters` [default: `{}`].
* `query` - Object containing querystring values to be appended to the `path`.
Parsed from RAML `queryParameters` section [default: `{}`].
* `headers` - HTTP headers, parsed from RAML `headers` [default: `{}`].
* `body` - Entity body for POST, PUT, and PATCH requests. Must be a
JSON-serializable object. Parsed from RAML `example` [default: `{}`].

### test.response

- `status` - Expected HTTP response code, parsed from RAML response status.
- `schema` - Expected schema of HTTP response body, parsed from RAML response `schema`.
- `headers` - Object containing HTTP response headers from server [default: `{}`].
- `body` - HTTP response body (JSON-format) from server [default: `null`].
* `status` - Expected HTTP response code, parsed from RAML response status.
* `schema` - Expected schema of HTTP response body, parsed from RAML response `schema`.
* `headers` - Object containing HTTP response headers from server [default: `{}`].
* `body` - HTTP response body (JSON-format) from server [default: `null`].

## Command Line Options

```
```console
Usage:
abao </path/to/raml> [OPTIONS]

Expand Down Expand Up @@ -273,6 +276,11 @@ $ npm test
**Abao** is always looking for new ideas to make the codebase useful.
If you think of something that would make life easier, please submit an issue.

```bash
$ npm issues abao
```


[//]: # (Cross reference section)

[RAML]: https://raml.org/
Expand All @@ -285,10 +293,10 @@ If you think of something that would make life easier, please submit an issue.

[Travis-Abao]: https://travis-ci.org/cybertk/abao/
[Travis-Abao-badge]: https://img.shields.io/travis/cybertk/abao.svg?style=flat
[David-AbaoDep]: https://david-dm.org/cybertk/abao/
[David-AbaoDep-badge]: https://david-dm.org/cybertk/abao/status.svg
[David-AbaoDevDep]: https://david-dm.org/cybertk/abao?type=dev
[David-AbaoDevDep-badge]: https://david-dm.org/cybertk/abao/dev-status.svg
[DavidDM-AbaoDep]: https://david-dm.org/cybertk/abao/
[DavidDM-AbaoDep-badge]: https://david-dm.org/cybertk/abao/status.svg
[DavidDM-AbaoDevDep]: https://david-dm.org/cybertk/abao?type=dev
[DavidDM-AbaoDevDep-badge]: https://david-dm.org/cybertk/abao/dev-status.svg
[Coveralls-Abao]: https://coveralls.io/r/cybertk/abao/
[Coveralls-Abao-badge]: https://img.shields.io/coveralls/cybertk/abao.svg
[Gitter-Abao]: https://gitter.im/cybertk/abao/
Expand All @@ -298,4 +306,3 @@ If you think of something that would make life easier, please submit an issue.
[NPM-Abao]: https://npmjs.org/package/abao/
[NPM-Abao-badge]: https://nodei.co/npm/abao.png?downloads=true&downloadRank=true&stars=true


3 changes: 1 addition & 2 deletions bin/abao
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ var path = require('path');
var fs = require('fs');

var libpath = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');

require(libpath + '/cli');
require(libpath + '/cli').main(process.argv.slice(2));

Loading

0 comments on commit eb850ef

Please sign in to comment.