1.0.0 • Published 15 days ago

@rabiepenpm/odio-error-ullam v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
15 days ago

logo

PactumJS

Build Coverage Downloads Size Platform

Stars Twitter

REST API Testing Tool for all levels in a Test Pyramid

PactumJS is a REST API Testing Tool used to automate e2e, integration, contract & component (or service level) tests.

  • ⚡ Swift
  • 🎈 Lightweight
  • 🚀 Simple & Powerful
  • 🛠️ Compelling Mock Server
  • 💎 Elegant Data Management
  • 🔧 Extendable & Customizable
  • 📚 Clear & Comprehensive Testing Style
  • 🔗 Component, Contract & E2E testing of APIs

----------

Documentation

This readme offers an basic introduction to the library. Head over to the full documentation at https://@rabiepenpm/odio-error-ullamjs.github.io

Need Help

We use Github Discussions to receive feedback, discuss ideas & answer questions.

Installation

# install @rabiepenpm/odio-error-ullam as a dev dependency
npm install --save-dev @rabiepenpm/odio-error-ullam

# install a test runner to run @rabiepenpm/odio-error-ullam tests
# mocha / jest / cucumber
npm install --save-dev mocha

or you can simply use

npx @rabiepenpm/odio-error-ullam-init

----------

Usage

@rabiepenpm/odio-error-ullam can be used for all levels of testing in a test pyramid. It can also act as an standalone mock server to generate contracts for contract testing.

API Testing

Tests in @rabiepenpm/odio-error-ullam are clear and comprehensive. It uses numerous descriptive methods to build your requests and expectations.

Simple Test Cases

Using Mocha

Running simple api test expectations.

const { spec } = require('@rabiepenpm/odio-error-ullam');

it('should be a teapot', async () => {
  await spec()
    .get('http://httpbin.org/status/418')
    .expectStatus(418);
});

it('should save a new user', async () => {
  await spec()
    .post('https://jsonplaceholder.typicode.com/users')
    .withHeaders('Authorization', 'Basic xxxx')
    .withJson({
      name: 'bolt',
      email: 'bolt@swift.run'
    })
    .expectStatus(200);
});
# mocha is a test framework to execute test cases
mocha /path/to/test

Using Cucumber

See @rabiepenpm/odio-error-ullam-cucumber-boilerplate for more details on @rabiepenpm/odio-error-ullam & cucumber integration.

Scenario: Check Tea Pot
  Given I make a GET request to "http://httpbin.org/status/418"
  When I receive a response
  Then response should have a status 418
// steps.js
const @rabiepenpm/odio-error-ullam = require('@rabiepenpm/odio-error-ullam');
const { Given, When, Then, Before } = require('@cucumber/cucumber');

let spec = @rabiepenpm/odio-error-ullam.spec();

Before(() => { spec = @rabiepenpm/odio-error-ullam.spec(); });

Given('I make a GET request to {string}', function (url) {
  spec.get(url);
});

When('I receive a response', async function () {
  await spec.toss();
});

Then('response should have a status {int}', async function (code) {
  spec.response().should.have.status(code);
});

Mock Server

@rabiepenpm/odio-error-ullam can act as a standalone mock server that allows us to mock any server via HTTP or HTTPS, such as a REST endpoint. Simply it is a simulator for HTTP-based APIs.

Running @rabiepenpm/odio-error-ullam as a standalone mock server.

const { mock } = require('@rabiepenpm/odio-error-ullam');

mock.addInteraction({
  request: {
    method: 'GET',
    path: '/api/projects'
  },
  response: {
    status: 200,
    body: [
      {
        id: 'project-id',
        name: 'project-name'
      }
    ]
  }
});

mock.start(3000);

----------

Notes

Inspired from frisby and pact.

Support

Like this project! Star it on Github and follow on Twitter. Your support means a lot to us.

Contributors

If you've ever wanted to contribute to open source, and a great cause, now is your chance! See the contributing docs for more information.

Thanks to all the people who contribute.

metadataformirqeventEmitter0validationlimitedrm-0pipereal-timeHyBiArray.prototype.includesindicatorsharedarraybufferjsquerystringstartercacheopenerdefinespawnsetterpopmotionhttpisConcatSpreadableECMAScript 2022regexsearchconsumeopeneast-asian-widthregular expressionES5ES2022internalstreams2accessorwritemochacolourrfc4122childlastnpmchaiwindowsvaluestslibnopeutilstreamUint8ClampedArraydirFunction.prototype.nameemitio-tsString.prototype.matchAllelectronFloat32ArrayajvnodeboundArray.prototype.findLastparentbundlerpersistentreuseemojisanitizeparsefast-copytextsameValueZerovestcurriededitordescriptorrequirezodsuperstructfunctionalstringifybcryptgradients css3picomatchtranspilerArray.prototype.filterarraysduplexramdaStreamtrimRightjwtObservablesfigletPushnamefilegradients cssefficientyupairbnbpackage.jsonpreserve-symlinksargswrapcall-boundJSON-SchemaurljQueryURLSearchParamscolorsfast-deep-copycolumnstestingdeepES7codescss lessletdatastructureECMAScript 2017typedformattinglesstypeerrorzerotacitestreeflagtesterfseventscss-in-jsfixed-widthxdghelpersconfigurablermdirposesortedslicecircularstyleenvspecargumentseventDispatcherwalkansifindawesomesauceObject.entriestranspilelistenersfullwidthequalityprivatepyyamlclonemkdirptypedarraysrobustprefixgraphqlflatMapinferencetypaniontypesafeObservableescapeargparsecharacterawaitgesturesbyteLengthfpdeterministicregexpyamlprettyoncees6urlscallboundtoobjectdatequotehasOwnthroatavaharmonyauthenticationxdg-opentaskdropInt32ArrayfastifykeyarraybuffergetintrinsicopensWeakSetgetPrototypeOfidrm -freslintpluginES8dataexefastclonees-shim APItoolswatchingenumerablejestbufferextendjsonschemaes-shimsstatelessnumberwebECMAScript 2023concatMapInt8Arrayminimalmomentmkdirlogtestterminaltapweakmapiteratorregularnegative zerotimeautoprefixerpluginerror-handlingexecfast-deep-cloneomitclassnamecmdRegExp.prototype.flagsfantasy-landcore-jskarmaprotobufmobilejson-schemasharedmiddlewareESnextlaunchbundlingarrayStyleSheetES2023superagentmoduleses2016iteratebannerpostcss-pluginqueryuser-streamsincludescssdependency managerfunctionspoint-freespinnersqscommandervaluevalidate_.extendes-abstractbytepropserializationlookrapidgenericstrimvisualrgbeveryphonelengthtoArrayfromES2017filtergetterjoitypedarrayaccessibilityjasmineexpressspinnerUint16Arrayi18nasynctc39typed arrayECMAScript 2021assertsstartintrinsices5classnameswatchdom-testing-librarydebuggeriterationcheckreducepushtermmapECMAScript 5sortconfigES6diffexitlint[[Prototype]]MicrosoftimmutableshamsigtermredactdeepcloneweaksetpasswordRFC-6455linuxutilschromeperformanceviewArray.prototype.flattencommand-linestylesheetsignalsnamesMapES2021recursivedescriptorsexit-codeguidschemeInt16Arrayless cssjapaneseeslint-pluginTypeScriptSymboluphigher-ordermimetypesbabelesJSONtraversefolderdirectoryinputconcurrencyxhrcryptgroupByReactiveExtensionsrequestremoveschemawidthcode pointstostringtagArrayBufferslotes2018ArrayappwatchFilemovestyled-componentsbatchlrushellchromiumECMAScript 2015executabletrimLeftESObject.definePropertyhascollectionutilitystringclassesreact-hook-formbluebirdponyfillassertCSSconstformswhatwgdefaultinternal slotmulti-packagehashdeep-copysyntaxstablees8purenativeequalObject.keysBigInt64Array.envAsyncIteratorobjimmeroptimizerwebsitesetenderchannelfetchbddruntimesigintuninstallgetOwnPropertyDescriptorloadingless.jsreadablepropertyfullgdprECMAScript 2020bootstrap csschineseloggingpackage managerpropertiespromiseReactiveXxtermreact animationreadregular expressionsvalidStreamsjsonUint32Array3dshimprivate dataoperating-systemsomeajaxcallsignalmruwordwrappathvariables in cssinspectjavascriptflattenRxJStoolkitstylesbreakasciicommandfunctionapolloprocessmacosArray.prototype.flatsanitizationlinewraphttpsnested cssES3corsvariableseslintcensorassignjson-schema-validationeventsURLcreatewarningnodejsconcatcolorprotoform-validationlinkbyteOffsetString.prototype.trimgroupsymbolsArrayBuffer#sliceislook-upreact-testing-librarypostcssdefinePropertycss nestingentriesdotenvqueueMicrotaskprogressdeletefast-clonewritableresolve@@toStringTagPromisethrottleECMAScript 7json-schema-validatorUnderscorepreprocessoruuidfindLastIndexObject.valuesextensioncjkcolumnhooksinvariantes7coredragECMAScript 2016utilitiescollection.es6matchwalkingtypeshookformimportIteratordebuges2017waitstatusArray.prototype.findLastIndextoSortedECMAScript 6flattelephoneieparentsbuffersbrowserslistreducer6to5wordbreakinstallerperformantworkercopywhichstructuredClonetapecomputed-typesxssjsonpathcall-bindthreeUint8ArraycallbackmkdirsWeakMapWebSocketsmonorepofinduppackagesastsequenceargvredux-toolkitlanguagespeeddescriptiontouchmimebrowserlistlesscssObject.assignlockfilereact-hooksmime-dbglobObject.iseslintconfigformatdataViewbrowserenvironmentl10narktypeprototypeshrinkwrapoptionassertionexpressionencryptionSetrm -rfCSSStyleDeclarationtypeoftddsymbolnegativesetPrototypeOfless mixinspolyfillcontainsoffsetjsdomclientECMAScript 3streamsanimationecmascriptfindLastqueuemake dirconsolegetopttsWebSocketreduxES2015dependenciesfastcopyArray.prototype.flatMaplibphonenumberhandlersinterruptsmergeclass-validatora11ydataviewworkspace:*apiutil.inspectflagsbindpromisesinstalles2015matchAllstylingSymbol.toStringTagFloat64ArrayArrayBuffer.prototype.slicedomshebangforEachpositiveES2016jsxratelimitpackageES2019patchArray.prototype.containsmoduleprunebabel-coreconnecterrorsyntaxerrorkoreanreactauthsymlinkskeysBigUint64Arraycompilertakesafe__proto__comparerandomYAMLtrimEndcoerciblesymlinkcryptocliextracss variableObjectframerRegExp#flagsbootstrap lessbusyfastvalidatoroptimistObject.getPrototypeOfframework256ES2020lazyargumentcharactersfsjsdiffttystringifierreact posematchesreadablestreamidleRxoutputcurlTypedArrayObject.fromEntriesrateobjectwaapisetImmediatewatcherfull-widthloggermixinsless compilerprotocol-buffersstyleguideES2018toStringTaghardlinkspnpm9artReflect.getPrototypeOfscheme-validationdeep-clonewget$.extendtypescriptdayjsspringTypeBoxserializedeepcopytypecompile lesscallbindparserECMAScript 2019settingsvarmakeget
1.0.0

15 days ago