Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orangewise/rotan
bamboo test utils
https://github.com/orangewise/rotan
coveralls-badge openapi swagger tape travis-badge
Last synced: about 1 month ago
JSON representation
bamboo test utils
- Host: GitHub
- URL: https://github.com/orangewise/rotan
- Owner: orangewise
- Created: 2016-06-20T10:28:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-07T07:59:50.000Z (over 6 years ago)
- Last Synced: 2024-12-09T13:02:02.148Z (about 2 months ago)
- Topics: coveralls-badge, openapi, swagger, tape, travis-badge
- Language: JavaScript
- Size: 187 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
rotan
=====[![npm version][npm-badge]][npm-url]
[![Build Status][travis-badge]][travis-url]
[![Coverage Status][coveralls-badge]][coveralls-url]
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)Rotan is a small command line utility to easily test your artifacts (in Bamboo :). It can output tap or xunit reports.
Currently you can do the following:
- test if your [OpenAPI](https://openapis.org) or [Swagger](http://swagger.io) files are valid
- test if your JSON/YAML is conform a [JSON schema](http://json-schema.org)
- run a custom tape test# Installation
```
npm install rotan
```## Getting help
- `rotan -h`
- `rotan openapi -h`
- `rotan json -h`
- `rotan js -h`# Examples
## Validate your OpenAPI or Swagger files
tap output:
```
rotan openapi openapi-definition.jsonTAP version 13
# Parse file openapi-definition.json
ok 1 Valid swagger file1..1
# tests 1
# pass 1# ok
```xunit reporting:
```
rotan openapi openapi-definition.json -x
```
## Validate a JSON/YAML file with a JSON schema
```
rotan json schema.json swagger.jsonTAP version 13
# Structure of input file should conform to the schema
ok 1 swagger.json is valid
ok 2 schema.json is valid JSON
ok 3 swagger.json is conform schema.json1..3
# tests 3
# pass 3# ok
``````
rotan json schema.json swagger.json -x
```
```
# inject snippets into your openapi before validating
rotan json schema.json swagger.yaml -i 'snippets/*.yaml'
TAP version 13
# Structure of input file should conform to the schema
ok 1 swagger.yaml is valid
ok 2 schema.json is valid JSON
ok 3 swagger.yaml is conform schema.json1..3
# tests 3
# pass 3# ok
```## Custom tape test
Create your [tape](https://www.npmjs.com/package/tape) tests like this:
```
// tests.js
exports.test = function (options) {
var test = options.tape.createHarness()
var stream = test.createStream()test('it should return ok', function (t) {
t.plan(1)
t.ok(true, 'looking good')
})return stream
}
```Then run it like this:
```
rotan js tests.jsTAP version 13
# it should return ok
ok 1 looking good1..1
# tests 1
# pass 1# ok
```or
```
rotan js tests.js -x
```
[npm-badge]: https://badge.fury.io/js/rotan.svg
[npm-url]: https://badge.fury.io/js/rotan
[travis-badge]: https://travis-ci.org/orangewise/rotan.svg?branch=master
[travis-url]: https://travis-ci.org/orangewise/rotan
[coveralls-badge]: https://coveralls.io/repos/github/orangewise/rotan/badge.svg?branch=master
[coveralls-url]: https://coveralls.io/github/orangewise/rotan?branch=master