Giter VIP home page Giter VIP logo

rotan's Introduction

rotan

npm version Build Status Coverage Status JavaScript Style Guide

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:

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.json

TAP version 13
# Parse file openapi-definition.json
ok 1 Valid swagger file

1..1
# tests 1
# pass  1

# ok

xunit 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

# ok
rotan 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

# ok

Custom 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

# ok

or

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>

rotan's People

Contributors

greenkeeper[bot] avatar orangewise avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

shrinkie

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.