Coder Social home page Coder Social logo

kaaron1 / redwiggler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nike-inc/redwiggler

0.0 2.0 0.0 110 KB

The composting worm. Composts your contract specification and tests and confirms that the contract specification is being followed.

License: BSD 3-Clause "New" or "Revised" License

Scala 92.82% Java 2.07% HTML 5.10%

redwiggler's Introduction

Red wiggler

The composting worm. Composts your contract specification and tests and confirms that the contract specification is being followed.

Build Status Coverage Status Download

Overview

RedWiggler has 3 main components:

  1. EndpointSpecifications: defines the endpoint contract. Defined from the API documentation

    • Swagger Support: Download
  2. EndpointCall: An instance of a request/response to the service to be matched against the EndpointSpecification

  3. ReportProcessor: Takes the result of the analysis and generates output (such as an html page)

    • HTML Reports: Downlaod

Usage

Currently, the jars are only available on bintray.

Gradle

    repositories {
        jCenter()
    }
    dependencies {
        compile groupId: 'com.nike.redwiggler', artifactId: 'redwiggler-core_2.12', verson: redwigglerVersion
        compile groupId: 'com.nike.redwiggler', artifactId: 'redwiggler-swagger_2.12', verson: redwigglerVersion
        compile groupId: 'com.nike.redwiggler', artifactId: 'redwiggler-reports-html_2.12', verson: redwigglerVersion
        compile groupId: 'com.nike.redwiggler', artifactId: 'redwiggler-restassured_2.12', verson: redwigglerVersion
    }

Sbt

    Resolvers += Resolver.jcenterRepo
    libraryDependencies ++= Seq("core", "swagger", "reports-html", "restassured")
      .map(library => "com.nike.redwiggler" %% library % redwigglerVersion)

Examples

import com.nike.redwiggler.core._
import com.nike.redwiggler.swagger._
import com.nike.redwiggler.html._

val swagger = SwaggerEndpointSpecificationProvider(
  """
    |swagger: "2.0"
    |paths:
    |  /:
    |    get:
    |      description: Gets Item
    |      responses:
    |        200:
    |          schema:
    |            properties:
    |              id:
    |                type: string
    """.stripMargin)
    
import java.io._
val requestDir = File.createTempFile("redwiggler", "requests")
requestDir.delete()
requestDir.mkdir()
val requests = new GlobEndpointCallProvider(requestDir, ".*.json")

val htmlReportFile = File.createTempFile("redwiggler", ".html")
val htmlRender = HtmlReportProcessor(htmlReportFile)

Redwiggler(callProvider = requests, specificationProvider = swagger, reportProcessor = htmlRender)

htmlReportFile.exists() should be(true)

Current features:

  • Supports swagger 2.0
  • Compares every call to every schema and sees if there's a match to path, code and request schema
  • 5 types of outcome:
    • schema validation fails
    • call not matched by schema
    • schema is not covered
    • schema validation passes
    • call is matched by multiple schemas
  • Outputs a report in html format

redwiggler's People

Contributors

tylersouthwick avatar

Watchers

James Cloos avatar Kyle Aaron avatar

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.