2.11.111 • Published 10 months ago

@patrtorg/at-quaerat v2.11.111

Weekly downloads
-
License
MIT
Repository
github
Last release
10 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

10 months ago

2.11.111

10 months ago

2.9.85

11 months ago

2.9.86

11 months ago

2.9.84

11 months ago

2.9.87

11 months ago

2.11.100

10 months ago

2.11.101

10 months ago

2.11.102

10 months ago

2.11.103

10 months ago

2.11.104

10 months ago

2.11.105

10 months ago

2.11.106

10 months ago

2.11.107

10 months ago

2.11.108

10 months ago

2.11.109

10 months ago

2.11.97

10 months ago

2.11.98

10 months ago

2.11.99

10 months ago

2.10.90

11 months ago

2.10.91

11 months ago

2.10.92

10 months ago

2.10.93

10 months ago

2.10.94

10 months ago

2.10.95

10 months ago

2.10.96

10 months ago

2.10.97

10 months ago

2.10.87

11 months ago

2.10.88

11 months ago

2.10.89

11 months ago

2.9.83

11 months ago

2.9.82

11 months ago

2.9.81

11 months ago

2.9.80

11 months ago

2.9.79

11 months ago

2.9.78

11 months ago

2.9.77

11 months ago

2.9.76

11 months ago

2.9.75

11 months ago

2.9.74

11 months ago

2.9.73

11 months ago

2.9.72

11 months ago

2.9.71

11 months ago

2.9.70

11 months ago

2.9.69

11 months ago

2.8.69

11 months ago

2.8.68

11 months ago

2.8.67

11 months ago

2.8.66

11 months ago

2.8.65

11 months ago

2.8.64

11 months ago

2.8.63

12 months ago

2.8.62

12 months ago

2.8.61

12 months ago

2.8.60

12 months ago

2.8.59

12 months ago

2.8.58

12 months ago

2.8.57

12 months ago

2.8.56

12 months ago

2.8.55

12 months ago

2.8.54

12 months ago

2.8.53

12 months ago

1.8.53

12 months ago

1.8.52

12 months ago

1.8.51

12 months ago

1.8.50

12 months ago

1.8.49

12 months ago

1.8.48

12 months ago

1.8.47

12 months ago

1.8.46

12 months ago

1.8.45

12 months 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