swagger-test-0.2.6: Testing of Swagger APIs

Copyright(c) Rodrigo Setti 2017
LicenseBSD3
Maintainerrodrigosetti@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Test.Swagger

Description

Re-exports

Synopsis

Documentation

generateRequest :: Seed -> Size -> NormalizedSwagger -> Maybe OperationId -> (Operation, HttpRequest) Source #

Given a swagger.json schema, produce a Request that complies with the schema. The return type is a random Request (in the IO monad because it's random).

requestFormats :: [Format] Source #

Valid output formats for HttpRequest values

responseFormats :: [Format] Source #

Valid output formats for HttpResponse values

printRequest :: Format -> HttpRequest -> Builder Source #

Print a request according to format

printResponse :: Format -> HttpResponse -> Builder Source #

Print a response according to format

doHttpRequest :: HttpRequest -> IO HttpResponse Source #

Executes the HTTP request and returns the HTTP response

type FullyQualifiedHost = String Source #

The FullyQualifiedHost contains the scheme (i.e. http://), hostname and port.

type Seed = Int Source #

type Size = Int Source #

refToMaybe :: Referenced a -> Maybe a Source #

Transform a reference into a Just value if is inline, Nothing, otherwise

isSuccessful :: TestReport -> Bool Source #

Predicate that tells whether or not a report is of a successful validation

writeReportFile :: FilePath -> NormalizedSwagger -> [TestReport] -> IO () Source #

Write a report file containing a header description about the Swagger schema, then a section about each Operation, how many tests were performed, general stats (# failuressuccesses) and requestresponse details for failures.

writeErrorReportFile :: FilePath -> String -> IO () Source #

Write a report file containing just a single error message. This is to be used if we find an error before being able to run any test (parsing schema, etc.)

runTests :: NormalizedSwagger -> Int -> Size -> IO [TestReport] Source #

Run n tests for a Swagger schema

parseResponse :: ByteString -> Either String HttpResponse Source #

Parse a HttpResponse from ByteString

validateResponseBytes :: ByteString -> NormalizedSwagger -> OperationId -> ValidationResult Source #

Validate a response, from a particular operation id, (encoded in a byte-string) against a Swagger schema

validateResponseWithOperation :: HttpResponse -> NormalizedSwagger -> Operation -> ValidationResult Source #

Validate a response, from a particular operation against a Swagger schema

validateResponse :: HttpResponse -> NormalizedSwagger -> OperationId -> ValidationResult Source #

Validate a response, from a particular operation id against a Swagger schema