2.11.111 • Published 12 months ago

@patrtorg/at-quaerat v2.11.111

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months 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://@patrtorg/at-quaeratjs.github.io

Need Help

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

Installation

# install @patrtorg/at-quaerat as a dev dependency
npm install --save-dev @patrtorg/at-quaerat

# install a test runner to run @patrtorg/at-quaerat tests
# mocha / jest / cucumber
npm install --save-dev mocha

or you can simply use

npx @patrtorg/at-quaerat-init

----------

Usage

@patrtorg/at-quaerat 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 @patrtorg/at-quaerat 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('@patrtorg/at-quaerat');

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 @patrtorg/at-quaerat-cucumber-boilerplate for more details on @patrtorg/at-quaerat & 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 @patrtorg/at-quaerat = require('@patrtorg/at-quaerat');
const { Given, When, Then, Before } = require('@cucumber/cucumber');

let spec = @patrtorg/at-quaerat.spec();

Before(() => { spec = @patrtorg/at-quaerat.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

@patrtorg/at-quaerat 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 @patrtorg/at-quaerat as a standalone mock server.

const { mock } = require('@patrtorg/at-quaerat');

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.

subprocessautoprefixerdiffmkdirpPromiseparentbusycode pointstyped arraycolumnreverseenvironmentposeestreevariablessource mapflagsStreamstestingrmdirapollotrimRightbuffersemitfind-upslicefullserializereversedmkdirsymbolssettings_.extendES2020deep-copyJSONbrowserlistdescriptionAsyncIteratorcallmochamodulesqueueMicrotaskfunction.lengthfunctionsbindes5es8vestroutexmlreduceequalityjsonrmstylesemojiisConcatSpreadablechromiumSetletcreateURLworkerjestbabelprototypefselectron.gitignorecurlfastifyshebangObservablepostcsspruneconfigurableexpressiterateArrayBuffer#slicebinarylistenersajaxTypeBoxmodulebyteOffsetwriteweaksettestershimvalidationrapidargsECMAScript 2023inputObject.fromEntrieswidthsimpledbcjkMapsharedarraybufferespreeefficientchromeargvendpointes-shim APIinternalBigInt64Arrayinferencecoveragesyntaxebsdependency managerairbnbbeanstalkwhichcallbindproxyclasses[[Prototype]]ReactiveExtensionsReflect.getPrototypeOfutil.inspectdragtypedwalkHyBisnschaifetchUint8ArrayspawnfpObject.assigndefinePropertyjsonschemaoptimizer__proto__safevalidatorgetopttostringtagcore-jsArrayBuffer.prototype.sliceECMAScript 2017lockfileimportpropertiespyyamlcollection.es6fastcopyargumentprivateregular-expression3dcurriedsetImmediatecliflattenhas-ownvaluesloadingkinesisflagunicodeschemaes6yupasterisksSymbol.toStringTagloadbalancing0ES8instrumentationcensorl10ndeeprm -rfeslintconfighasOwnPropertyregexpio-tsbyteLengthdeepcopyECMAScriptdefinedeep-cloneJSON-Schemafunctionec2zxquoteerrorconcatcopyreworkpureautoscalingruntimeRxanimationshamjsdiffrouterjQuerytoobjectURLSearchParamseast-asian-widthprotoprocesslanguagetypescriptFunction.prototype.namefunctionalnamestypesafeUnderscoreponyfilljapanesecall-boundfeedes7route53ECMAScript 2019sinatramobileArray.prototype.flattentacitreusetrimStartqschecklinkexpressionBigUint64ArraycryptofindLastIndexentriesES2022binreact-hook-formtoStringTagclass-validatorobjYAMLObject.keyspushFloat32ArrayObjecttrimLeftworkflowmovenodejsbrowserES2023bundlerdirectoryESnextdebuggerchinesees-abstractttyWeakSetmetadatagraphqlformatstringjoiperformantdynamodbwgetECMAScript 6ajvpipeglobalidlearraybufferramdahasOwnArray.prototype.findLastwindowsqsperformanceglobal objectassertsnumberdateWeakMapconstwarningcolorECMAScript 5Observableswritabletoolkitredux-toolkitcharactersthreezeroinstallerviewimmerlintArray.prototype.containsamazoncolorsfast-copyawsprefixpluginelbsideindicatorpopmotionmatchAllInt16ArraytrimEndkeyhooksjson-schema-validatoruninstallObject.entriesreactStreammergehelpersdropfindLastfast-deep-copyfpskarmaiteratorflatMapcommand-linebddavacloneterminalquerystringnpmjasminegettertslibarraysvalidateObject.definePropertyaccessorstreamStyleSheetmatchesstreamsapiUint8ClampedArrayloghookformregular expressionseventEmitterRxJSlook-upruleswhatwgpropertyreal-timeRegExp#flagsgdprobjectglobalssetcollectiontranspiletouchtc39preprocessorgetOwnPropertyDescriptorreadablestreamrandomtestcloudformationvalueconfigvalididentifiersnegative zeroextrarm -frRFC-6455queryglobalThisdataViewparserspeedcloudwatchoptimistwafcommandwaitObject.isclienteffect-tssuperagentWebSocketprotobuftransformoffsetECMAScript 2021patchselfpicomatchES5typedarraysphonees2017regular expressionregexextendimportexportinternal slotflatdataECMAScript 2016ES6Uint16ArraycolourtddArray.prototype.findLastIndexinstallresolvenopepromisehigher-orderjson-schema-validationcodesjavascriptsetterdayjs256robustexecutearktypeutilitiescloudfrontserializationxhrtoolseslintpluginartboundreact animationexecqueueproputilsdescriptorsMicrosoftrequiredescriptoreveryenderpackage.jsonstringifysameValueZeroCSScloudtrailpathastroutingiescheme-validationArray.prototype.includespackagesnpmignorespinnersenumerablearrayoncemapreducereduxmonorepodomArrayvpcemrloggingspinnereslint-pluginES2017htmlfilefilterownuser-streamsprivate datanodemruvisualgenericstelephoneasyncObject.getPrototypeOfreact pose
2.11.110

12 months ago

2.11.111

12 months ago

2.9.85

1 year ago

2.9.86

1 year ago

2.9.84

1 year ago

2.9.87

1 year ago

2.11.100

1 year ago

2.11.101

1 year ago

2.11.102

1 year ago

2.11.103

1 year ago

2.11.104

1 year ago

2.11.105

1 year ago

2.11.106

1 year ago

2.11.107

1 year ago

2.11.108

1 year ago

2.11.109

12 months ago

2.11.97

1 year ago

2.11.98

1 year ago

2.11.99

1 year ago

2.10.90

1 year ago

2.10.91

1 year ago

2.10.92

1 year ago

2.10.93

1 year ago

2.10.94

1 year ago

2.10.95

1 year ago

2.10.96

1 year ago

2.10.97

1 year ago

2.10.87

1 year ago

2.10.88

1 year ago

2.10.89

1 year ago

2.9.83

1 year ago

2.9.82

1 year ago

2.9.81

1 year ago

2.9.80

1 year ago

2.9.79

1 year ago

2.9.78

1 year ago

2.9.77

1 year ago

2.9.76

1 year ago

2.9.75

1 year ago

2.9.74

1 year ago

2.9.73

1 year ago

2.9.72

1 year ago

2.9.71

1 year ago

2.9.70

1 year ago

2.9.69

1 year ago

2.8.69

1 year ago

2.8.68

1 year ago

2.8.67

1 year ago

2.8.66

1 year ago

2.8.65

1 year ago

2.8.64

1 year ago

2.8.63

1 year ago

2.8.62

1 year ago

2.8.61

1 year ago

2.8.60

1 year ago

2.8.59

1 year ago

2.8.58

1 year ago

2.8.57

1 year ago

2.8.56

1 year ago

2.8.55

1 year ago

2.8.54

1 year ago

2.8.53

1 year ago

1.8.53

1 year ago

1.8.52

1 year ago

1.8.51

1 year ago

1.8.50

1 year ago

1.8.49

1 year ago

1.8.48

1 year ago

1.8.47

1 year ago

1.8.46

1 year ago

1.8.45

1 year ago

1.8.44

1 year ago

1.8.43

1 year ago

1.8.42

1 year ago

1.8.41

1 year ago

1.8.40

1 year ago

1.7.40

1 year ago

1.7.39

1 year ago

1.7.38

1 year ago

1.6.38

1 year ago

1.6.37

1 year ago

1.6.36

1 year ago

1.6.35

1 year ago

1.6.34

1 year ago

1.6.33

1 year ago

1.6.32

1 year ago

1.5.32

1 year ago

1.5.31

1 year ago

1.4.31

1 year ago

1.4.30

1 year ago

1.4.29

1 year ago

1.4.28

1 year ago

1.4.27

1 year ago

1.4.26

1 year ago

1.3.26

1 year ago

1.2.26

1 year ago

1.2.25

1 year ago

1.2.24

1 year ago

1.2.23

1 year ago

1.2.22

1 year ago

1.2.21

1 year ago

1.2.20

1 year ago

1.2.19

1 year ago

1.2.18

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago