2.0.0 • Published 7 years ago
rotan v2.0.0
rotan
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 or Swagger files are valid
- test if your JSON/YAML is conform a JSON schema
- run a custom tape test
Installation
npm install rotanGetting help
rotan -hrotan openapi -hrotan json -hrotan js -h
Examples
Validate your OpenAPI or Swagger files
tap output:
rotan openapi openapi-definition.json
TAP version 13
# Parse file openapi-definition.json
ok 1 Valid swagger file
1..1
# tests 1
# pass 1
# okxunit reporting:
rotan openapi openapi-definition.json -x
<?xml version="1.0"?>
<testsuites>
<testsuite name="Parse file use-rotan-swagger.json" tests="1" failures="0" errors="0">
<testcase name="#1 Valid swagger file"/>
</testsuite>
</testsuites>Validate a JSON/YAML file with a JSON schema
rotan json schema.json swagger.json
TAP 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.json
1..3
# tests 3
# pass 3
# okrotan json schema.json swagger.json -x
<?xml version="1.0"?>
<testsuites>
<testsuite name="Structure of iput file should conform to the schema" tests="3" failures="0" errors="0">
<testcase name="#1 swagger.json is valid"/>
<testcase name="#2 schema.json is valid JSON"/>
<testcase name="#3 swagger.json is conform schema.json"/>
</testsuite>
</testsuites># 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.json
1..3
# tests 3
# pass 3
# okCustom tape test
Create your 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.js
TAP version 13
# it should return ok
ok 1 looking good
1..1
# tests 1
# pass 1
# okor
rotan js tests.js -x
<?xml version="1.0"?>
<testsuites>
<testsuite name="it should return ok" tests="1" failures="0" errors="0">
<testcase name="#1 looking good"/>
</testsuite>
</testsuites>2.0.0
7 years ago
1.1.12
8 years ago
1.1.11
8 years ago
1.1.10
8 years ago
1.1.9
8 years ago
1.1.7
9 years ago
1.1.6
9 years ago
1.1.5
9 years ago
1.1.3
9 years ago
1.1.2
9 years ago
1.1.1
9 years ago
1.1.0
10 years ago
1.0.6
10 years ago
1.0.5
10 years ago
1.0.4
10 years ago
1.0.3
10 years ago
1.0.2
10 years ago
1.0.1
10 years ago
1.0.0
10 years ago
0.0.8
10 years ago
0.0.7
10 years ago
0.0.6
10 years ago
0.0.5
10 years ago
0.0.4
10 years ago
0.0.3
10 years ago
0.0.2
10 years ago
0.0.1
10 years ago