Repository: pactumjs/pactum
Pull request #73 (2021-06-19 08:57:28)

3.0.17
- deprecated `at` expectation methods
- invoke state handlers from remote mock server
- trimmed `JS Docs`
- removed `initialization` and `cleanup` handlers


Patch:
diff --git a/README.md b/README.md
index 841dc6a..1fbe161 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,9 @@
 ![Size](https://img.shields.io/bundlephobia/minzip/pactum)
 ![Platform](https://img.shields.io/node/v/pactum)
 
+![Stars](https://img.shields.io/github/stars/pactumjs/pactum?style=social)
+![Twitter](https://img.shields.io/twitter/follow/pactumjs?label=Follow&style=social)
+
 #### REST API Testing Tool for all levels in a Test Pyramid
 
 </span>
@@ -23,7 +26,7 @@
 <tr>
 <td>
 
-**PactumJS** is a REST API Testing Tool used to automate e2e, integration, contract & component (*or service level*) tests. It comes with a powerful *mock server* which can control the state of external dependencies.
+**PactumJS** is a REST API Testing Tool used to automate e2e, integration, contract & component (*or service level*) tests.
 
 - ⚡ Swift
 - 🎈 Lightweight
@@ -49,6 +52,7 @@ This readme offers an basic introduction to the library. Head over to the full d
 - [Component Testing](https://pactumjs.github.io/#/component-testing)
 - [Contract Testing](https://pactumjs.github.io/#/contract-testing)
 - [E2E Testing](https://pactumjs.github.io/#/e2e-testing)
+- [Mock Server](https://pactumjs.github.io/#/mock-server)
 
 ## Need Help
 
@@ -69,7 +73,7 @@ npm install --save-dev mocha
 
 # Usage
 
-**pactum** 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 consumer driven contract testing.
+**pactum** 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
 
@@ -81,7 +85,7 @@ Tests in **pactum** are clear and comprehensive. It uses numerous descriptive me
 
 Running simple api test expectations.
 
-```javascript
+```js
 const pactum = require('pactum');
 
 it('should be a teapot', async () => {
@@ -111,7 +115,14 @@ mocha /path/to/test
 
 See [pactum-cucumber-boilerplate](https://github.com/pactumjs/pactum-cucumber-boilerplate) for more details on pactum & cucumber integration.
 
-```javascript
+```gherkin
+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
+```
+
+```js
 // steps.js
 const pactum = require('pactum');
 const { Given, When, Then, Before } = require('cucumber');
@@ -133,20 +144,13 @@ Then('response should have a status {int}', async function (code) {
 });
 ```
 
-```gherkin
-Scenario: Check TeaPot
-  Given I make a GET request to "http://httpbin.org/status/418"
-  When I receive a response
-  Then response should have a status 200
-```
-
 ## Mock Server
 
 **pactum** 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 **pactum** as a standalone *mock server*.
 
-```javascript
+```js
 const { mock } = require('pactum');
 
 mock.addInteraction({
@@ -178,11 +182,9 @@ Inspired from [frisby](https://docs.frisbyjs.com/) and [pact](https://docs.pact.
 
 Like this project! Star it on [Github](https://github.com/pactumjs/pactum/stargazers). Your support means a lot to us.
 
-<a href="https://github.com/pactumjs/pactum/stargazers"><img src="https://img.shields.io/github/stars/pactumjs/pactum?style=social" style="margin-left:0;box-shadow:none;border-radius:0;height:24px"></a>
-
 ## Contributors
 
-If you've ever wanted to contribute to open source, and a great cause, now is your chance! See the [contributing docs](https://github.com/pactumjs/pactum/blob/master/CONTRIBUTING.md) for more information
+If you've ever wanted to contribute to open source, and a great cause, now is your chance! See the [contributing docs](https://github.com/pactumjs/pactum/blob/master/CONTRIBUTING.md) for more information.
 
 Thanks to all the people who contribute.
 
diff --git a/package-lock.json b/package-lock.json
index 1efc3bf..f7a9884 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "pactum",
-  "version": "3.0.16",
+  "version": "3.0.17",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
@@ -1262,9 +1262,9 @@
       "integrity": "sha512-ZRbnvdg/NxqzC7L9Uyqzf4psi1OM4Cuc+sJAkQPjO6XkQIJTNbfK2Rsmbw8fx1p2mkZdp2FZYo2+LwXYY/uwIA=="
     },
     "lightcookie": {
-      "version": "1.0.24",
-      "resolved": "https://registry.npmjs.org/lightcookie/-/lightcookie-1.0.24.tgz",
-      "integrity": "sha512-yf/a/TljF53Mv5FnTixT1S5vKx3U4DPCx4YIC5iPNdReAeUdNNZIVxf85ldETGjKO74LWGcIVt9KP8owJyQOPw=="
+      "version": "1.0.25",
+      "resolved": "https://registry.npmjs.org/lightcookie/-/lightcookie-1.0.25.tgz",
+      "integrity": "sha512-SrY/+eBPaKAMnsn7mCsoOMZzoQyCyHHHZlFCu2fjo28XxSyCLjlooKiTxyrXTg8NPaHp1YzWi0lcGG1gDi6KHw=="
     },
     "locate-path": {
       "version": "6.0.0",
diff --git a/package.json b/package.json
index 66a720a..32a2920 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "pactum",
-  "version": "3.0.16",
+  "version": "3.0.17",
   "description": "REST API Testing Tool for all levels in a Test Pyramid",
   "main": "./src/index.js",
   "types": "./src/index.d.ts",
@@ -64,7 +64,7 @@
     "form-data": "^4.0.0",
     "json-query": "^2.2.2",
     "klona": "^2.0.4",
-    "lightcookie": "^1.0.24",
+    "lightcookie": "^1.0.25",
     "openapi-fuzzer-core": "^1.0.6",
     "pactum-matchers": "^1.0.2",
     "parse-graphql": "^1.0.0",
diff --git a/src/exports/expect.d.ts b/src/exports/expect.d.ts
index ba8e041..4008df3 100644
--- a/src/exports/expect.d.ts
+++ b/src/exports/expect.d.ts
@@ -7,15 +7,15 @@ export interface Have {
   body(value: any): void;
   bodyContains(value: any): void;
   json(value: any): void;
-  jsonAt(path: string, value: any): void;
+  json(path: string, value: any): void;
   jsonLike(value: any): void;
-  jsonLikeAt(path: string, value: any): void;
+  jsonLike(path: string, value: any): void;
   jsonSchema(schema: object): void;
-  jsonSchemaAt(path: string, schema: object): void;
+  jsonSchema(path: string, schema: object): void;
   jsonMatch(value: object): void;
-  jsonMatchAt(path: string, value: object): void;
+  jsonMatch(path: string, value: object): void;
   jsonMatchStrict(value: object): void;
-  jsonMatchStrictAt(path: string, value: object): void;
+  jsonMatchStrict(path: string, value: object): void;
   responseTimeLessThan(ms: number): void;
   error(err?: string | object): void;
   _(handler: string, data: any): Promise<void>;
diff --git a/src/exports/expect.js b/src/exports/expect.js
index ce93ae5..b3c9468 100644
--- a/src/exports/expect.js
+++ b/src/exports/expect.js
@@ -44,53 +44,28 @@ class Have {
     this._validate();
   }
 
-  json(value) {
-    this.expect.json.push(value);
+  json(path, value) {
+    typeof value === 'undefined' ? this.expect.json.push(path) : this.expect.jsonQuery.push({ path, value });
     this._validate();
   }
 
-  jsonLike(value) {
-    this.expect.jsonLike.push(value);
+  jsonLike(path, value) {
+    typeof value === 'undefined' ? this.expect.jsonLike.push(path) : this.expect.jsonQueryLike.push({ path, value });
     this._validate();
   }
 
-  jsonAt(path, value) {
-    this.expect.jsonQuery.push({ path, value });
+  jsonSchema(path, value) {
+    typeof value === 'undefined' ? this.expect.jsonSchema.push(path) : this.expect.jsonSchemaQuery.push({ path, value });
     this._validate();
   }
 
-  jsonLikeAt(path, value) {
-    this.expect.jsonQueryLike.push({ path, value });
+  jsonMatch(path, value) {
+    typeof value === 'undefined' ? this.expect.jsonMatch.push(path) : this.expect.jsonMatchQuery.push({ path, value });
     this._validate();
   }
 
-  jsonSchema(schema) {
-    this.expect.jsonSchema.push(schema);
-    this._validate();
-  }
-
-  jsonSchemaAt(path, value) {
-    this.expect.jsonSchemaQuery.push({ path, value });
-    this._validate();
-  }
-
-  jsonMatch(value) {
-    this.expect.jsonMatch.push(value);
-    this._validate();
-  }
-
-  jsonMatchAt(path, value) {
-    this.expect.jsonMatchQuery.push({ path, value });
-    this._validate();
-  }
-
-  jsonMatchStrict(value) {
-    this.expect.jsonMatchStrict.push(value);
-    this._validate();
-  }
-
-  jsonMatchStrictAt(path, value) {
-    this.expect.jsonMatchStrictQuery.push({ path, value });
+  jsonMatchStrict(path, value) {
+    typeof value === 'undefined' ? this.expect.jsonMatchStrict.push(path) : this.expect.jsonMatchStrictQuery.push({ path, value });
     this._validate();
   }
 
diff --git a/src/exports/handler.d.ts b/src/exports/handler.d.ts
index 9bd5cb6..a16799e 100644
--- a/src/exports/handler.d.ts
+++ b/src/exports/handler.d.ts
@@ -68,21 +68,25 @@ export type AssertHandlerFunction = (ctx: AssertionContext) => boolean;
 
 /**
  * adds a custom spec handler
+ * @see https://pactumjs.github.io/#/api-handlers?id=addspechandler
  */
 export function addSpecHandler(name: string, func: SpecHandlerFunction): void;
 
 /**
  * adds a custom expect handler
+ * @see https://pactumjs.github.io/#/api-handlers?id=addexpecthandler
  */
 export function addExpectHandler(name: string, func: ExpectHandlerFunction): void;
 
 /**
  * adds a custom retry handler
+ * @see https://pactumjs.github.io/#/api-handlers?id=addretryhandler
  */
 export function addRetryHandler(name: string, func: RetryHandlerFunction): void;
 
 /**
  * adds a custom return handler
+ * @see https://pactumjs.github.io/#/api-handlers?id=addcapturehandler
  */
 export function addCaptureHandler(name: string, func: CaptureHandlerFunction): void;
 
@@ -93,15 +97,18 @@ export function addStateHandler(name: string, func: StateHandlerFunction): void;
 
 /**
  * adds a custom data handler
+ * @see https://pactumjs.github.io/#/api-handlers?id=adddatahandler
  */
 export function addDataFuncHandler(name: string, func: DataHandlerFunction): void;
 
 /**
  * adds a custom interaction handler
+ * @see https://pactumjs.github.io/#/api-handlers?id=addinteractionhandler
  */
 export function addInteractionHandler(name: string, func: InteractionHandlerFunction): void;
 
 /**
  * adds a custom assert handler
+ * @see https://pactumjs.github.io/#/api-handlers?id=addasserthandler
  */
 export function addAssertHandler(name: string, func: AssertHandlerFunction): void;
\ No newline at end of file
diff --git a/src/exports/handler.js b/src/exports/handler.js
index 2d1e77a..8d2ff83 100644
--- a/src/exports/handler.js
+++ b/src/exports/handler.js
@@ -9,8 +9,6 @@ const stateHandlers =  {};
 const dataHandlers = {};
 const interactionHandlers = {};
 const assertHandlers = {};
-const initializeHandlers = {};
-const cleanupHandlers = {};
 
 const handler = {
 
@@ -93,25 +91,7 @@ const handler = {
   getAssertHandler(name) {
     if (assertHandlers[name]) return assertHandlers[name];
     throw new PactumHandlerError(`Assert Handler Not Found - '${name}'`);
-  },
-
-  addInitializeHandler(name, func) {
-    isValidHandler(name, func);
-    initializeHandlers[name] = func;
-  },
-
-  getInitializeHandlers() {
-    return initializeHandlers;
-  },
-
-  addCleanupHandler(name, func) {
-    isValidHandler(name, func);
-    cleanupHandlers[name] = func;
-  },
-
-  getCleanupHandlers() {
-    return cleanupHandlers;
-  },
+  }
 
 };
 
diff --git a/src/exports/mock.d.ts b/src/exports/mock.d.ts
index 054f789..cdfbc7b 100644
--- a/src/exports/mock.d.ts
+++ b/src/exports/mock.d.ts
@@ -66,36 +66,21 @@ export interface Handler {
 }
 
 /**
- * starts the mock server on port 9393
+ * starts the mock server
+ * @see https://pactumjs.github.io/#/mock-server
  */
 export function start(): Promise<void>;
-
-/**
- * starts the mock server on specified port
- * @example
- * await mock.start(3000);
- */
 export function start(port: number): Promise<void>;
 
 /**
  * stops the mock server
+ * @see https://pactumjs.github.io/#/mock-server
  */
 export function stop(): Promise<void>;
 
 /**
  * adds a interaction
- * @returns interaction id
- * @example
- * mock.addInteraction({
- *  request: {
- *   method: 'GET',
- *   path: '/api/orders'
- *  },
- *  response: {
- *   status: 200,
- *   body: 'your orders'
- *  }
- * });
+ * @see https://pactumjs.github.io/#/mock-server
  */
 export function addInteraction(interaction: Interaction): string | Promise<string>;
 export function addInteraction(interactions: Interaction[]): string[] | Promise<string[]>;
@@ -106,24 +91,27 @@ export function addInteraction(handlers: Handler[], data?: any): string[] | Prom
 
 /**
  * returns interaction details
+ * @see https://pactumjs.github.io/#/mock-server
  */
 export function getInteraction(id: string): InteractionDetails | Promise<InteractionDetails>;
 export function getInteraction(ids: string[]): InteractionDetails[] | Promise<InteractionDetails[]>;
 
 /**
  * removes specified interaction from the mock server
- * @param id interaction id
+ * @see https://pactumjs.github.io/#/mock-server
  */
 export function removeInteraction(id: string): void | Promise<void>;
 export function removeInteraction(ids: string[]): void | Promise<void>;
 
 /**
  * clears all interactions from the server
+ * @see https://pactumjs.github.io/#/mock-server
  */
 export function clearInteractions(): void;
 
 /**
  * use remote pactum server
  * all methods in mock will return promises
+ * @see https://pactumjs.github.io/#/mock-server
  */
 export function useRemoteServer(url: string): void;
\ No newline at end of file
diff --git a/src/exports/reporter.d.ts b/src/exports/reporter.d.ts
index ceb396d..ac9e07e 100644
--- a/src/exports/reporter.d.ts
+++ b/src/exports/reporter.d.ts
@@ -48,9 +48,14 @@ export interface Reporter {
   end(): void | Promise<void>
 }
 
+/**
+ * adds custom reporters
+ * @see https://pactumjs.github.io/#/api-reporter
+ */
 export function add(reporter: Reporter): void;
 
 /**
  * runs end function of all added reporters
+ * @see https://pactumjs.github.io/#/api-reporter
  */
 export function end(): Promise<void>;
\ No newline at end of file
diff --git a/src/helpers/handler.runner.js b/src/helpers/handler.runner.js
index 29a7271..e7e3766 100644
--- a/src/helpers/handler.runner.js
+++ b/src/helpers/handler.runner.js
@@ -1,5 +1,4 @@
 const handler = require('../exports/handler');
-const log = require('../plugins/logger');
 
 const hr = {
 
@@ -31,22 +30,8 @@ const hr = {
     }
   },
 
-  async initialize() {
-    const handlers = handler.getInitializeHandlers();
-    const keys = Object.keys(handlers);
-    for (let i = 0; i < keys.length; i++) {
-      log.info(`Running Initializer - ${keys[i]}`);
-      await handlers[keys[i]]();
-    }
-  },
-
-  async cleanup() {
-    const handlers = handler.getCleanupHandlers();
-    const keys = Object.keys(handlers);
-    for (let i = 0; i < keys.length; i++) {
-      log.info(`Running Cleaner - ${keys[i]}`);
-      await handlers[keys[i]]();
-    }
+  state(name, data) {
+    return handler.getStateHandler(name)({ data });
   }
 
 };
diff --git a/src/models/Fuzz.d.ts b/src/models/Fuzz.d.ts
index 7bc6cef..d13fe1a 100644
--- a/src/models/Fuzz.d.ts
+++ b/src/models/Fuzz.d.ts
@@ -1,44 +1,30 @@
-import { MockInteraction } from '../exports/mock';
+import { Interaction } from '../exports/mock';
 
 declare class Fuzz {
   /**
    * run fuzz testing on swagger url
-   * @example
-   * await pactum.fuzz()
-   *  .onSwagger('/api/swagger.json');
+   * @see https://pactumjs.github.io/#/fuzz-testing
    */
   onSwagger(url: string): Fuzz;
 
   /**
    * attaches headers to all the requests
-   * @example
-   * await pactum.fuzz()
-   *  .onSwagger('/api/swagger.json')
-   *  .withHeaders('Authorization', 'Basic xxx')
-   *  .withHeaders({
-   *    'content-type': 'application/json'
-   *  });
+   * @see https://pactumjs.github.io/#/fuzz-testing
    */
   withHeaders(key: string, value: any): Fuzz;
   withHeaders(headers: object): Fuzz;
 
   /**
    * adds a mock interaction to the server & auto removed after execution
-   * @example
-   * await pactum.fuzz()
-   *  .useMockInteraction('handler name')
-   *  .onSwagger('/api/swagger.json');
+   * @see https://pactumjs.github.io/#/fuzz-testing
    */
-  useMockInteraction(interaction: MockInteraction): Fuzz;
-  useMockInteraction(handler: string, data?: any): Fuzz;
+  useInteraction(interaction: Interaction): Fuzz;
+  useInteraction(handler: string, data?: any): Fuzz;
 
   /**
    * number of requests to sent in each batch
    * @default 10
-   * @example
-   * await pactum.fuzz()
-   *  .onSwagger('/api/swagger.json') 
-   *  .withBatchSize(15);
+   * @see https://pactumjs.github.io/#/fuzz-testing
    */
   withBatchSize(size: number): Fuzz;
 
diff --git a/src/models/Spec.d.ts b/src/models/Spec.d.ts
index f20c02e..d9604a2 100644
--- a/src/models/Spec.d.ts
+++ b/src/models/Spec.d.ts
@@ -1,7 +1,7 @@
 import { RequestOptions } from 'http';
 import FormData from 'form-data';
 import { Interaction } from '../exports/mock';
-import { ExpectHandlerFunction, RetryHandlerFunction, ReturnHandlerFunction } from '../exports/handler';
+import { ExpectHandlerFunction, RetryHandlerFunction, CaptureHandlerFunction } from '../exports/handler';
 import { LogLevel } from '../exports/settings';
 import { Expect } from '../exports/expect';
 
@@ -40,229 +40,113 @@ declare class Spec {
 
   /**
    * runs custom spec handler
-   * @example
-   * await pactum.spec()
-   *  .use('spec handler name', { optional: 'data' })
-   *  .expectStatus(200);
+   * @see https://pactumjs.github.io/#/api-handlers?id=addspechandler
    */
   use(name: string, data?: any): Spec
 
   /**
    * adds a interaction to the server & auto removed after execution
-   * @example
-   * await pactum.spec()
-   *  .useInteraction({
-   *    request: {
-   *      method: 'GET',
-   *      path: '/api/projects/1'
-   *    },
-   *    response: {
-   *      status: 200,
-   *      body: {
-   *        id: 1,
-   *        name: 'fake'
-   *      }
-   *    }
-   *  })
-   *  .get('http://localhost:9393/projects/1')
-   *  .expectStatus(200);
+   * @see https://pactumjs.github.io/#/component-testing?id=simple-component-tests
    */
   useInteraction(interaction: Interaction): Spec;
   useInteraction(handler: string, data?: any): Spec;
 
   /**
    * The GET method requests a representation of the specified resource.
-   * @example
-   * await pactum.spec()
-   *  .get('https://jsonplaceholder.typicode.com/posts')
-   *  .withQueryParam('postId', 1)
-   *  .expectStatus(200)
-   *  .expectJsonLike({
-   *    userId: 1,
-   *    id: 1
-   *   });
+   * @see https://pactumjs.github.io/#/request-making?id=request-method
    */
   get(url: string): Spec;
 
   /**
    * The HEAD method asks for a response identical to that of a GET request, but without the response body.
+   * @see https://pactumjs.github.io/#/request-making?id=request-method
    */
   head(url: string): Spec;
 
   /**
    * The PATCH method is used to apply partial modifications to a resource.
-   * @example
-   * await pactum.spec()
-   *  .patch('https://jsonplaceholder.typicode.com/posts/1')
-   *  .withJson({
-   *    title: 'foo'
-   *  })
-   *  .expectStatus(200);
+   * @see https://pactumjs.github.io/#/request-making?id=request-method
    */
   patch(url: string): Spec;
 
   /**
    * The POST method is used to submit an entity to the specified resource, often causing a change in state or side effects on the server.
-   * @example
-   * await pactum.spec()
-   *  .post('https://jsonplaceholder.typicode.com/posts')
-   *  .withJson({
-   *    title: 'foo',
-   *    body: 'bar',
-   *    userId: 1
-   *  })
-   *  .expectStatus(201);
+   * @see https://pactumjs.github.io/#/request-making?id=request-method
    */
   post(url: string): Spec;
 
   /**
    * The PUT method replaces all current representations of the target resource with the request payload.
-   * @example
-   * await pactum.spec()
-   *  .put('https://jsonplaceholder.typicode.com/posts/1')
-   *  .withJson({
-   *    id: 1,
-   *    title: 'foo',
-   *    body: 'bar',
-   *    userId: 1
-   *  })
-   *  .expectStatus(200);
+   * @see https://pactumjs.github.io/#/request-making?id=request-method
    */
   put(url: string): Spec;
 
   /**
    * The DELETE method deletes the specified resource.
-   * @example
-   * await pactum.spec()
-   *  .delete('https://jsonplaceholder.typicode.com/posts/1')
-   *  .expectStatus(200);
+   * @see https://pactumjs.github.io/#/request-making?id=request-method
    */
   delete(url: string): Spec;
 
   /**
    * The OPTIONS method asks for request-methods supported by the request.
-   * @example
-   * await pactum.spec()
-   *  .options('https://jsonplaceholder.typicode.com/posts')
-   *  .expectStatus(204)
-   *  .expectHeader('Access-Control-Allow-Methods', 'GET,HEAD,PUT,PATCH,POST,DELETE');
+   * @see https://pactumjs.github.io/#/request-making?id=request-method
    */
   options(url: string): Spec;
 
   /**
    * The TRACE method echos the contents of an HTTP Request back to the requester
-   * @example
-   * await pactum.spec()
-   *  .trace('http://localhost:9393/projects/1')
-   *  .expectStatus(200);
+   * @see https://pactumjs.github.io/#/request-making?id=request-method
    */
   trace(url: string): Spec;
 
   /**
-   * The `withMethod` method extends the support for the request-methods apart from 
-   * (GET, POST, DELETE, PATCH, PUT, HEAD)
-   * 
-   * The `withPath` method triggers the request passed through withMethod()
-   * @example
-   * await pactum.spec()
-   *  .withMethod('HEAD')
-   *  .withPath('https://jsonplaceholder.typicode.com/posts')
-   *  .expectStatus(200);
+   * The `withMethod` method extends the support for the request-methods apart from GET, POST, DELETE, PATCH, PUT, HEAD
+   * @see https://pactumjs.github.io/#/request-making?id=non-crud-methods
    */
   withMethod(method: string): Spec;
+
+  /**
+   * The `withPath` method triggers the request passed through withMethod()
+   * @see https://pactumjs.github.io/#/request-making?id=non-crud-methods
+   */
   withPath(url: string): Spec;
 
   /**
-   * replaces path params in the request url - /api/users/mike
-   * @example
-   * await pactum.spec()
-   *  .get('/api/users/{username}')
-   *  .withPathParams('username', 'mike')
-   *  .expectStatus(200);
+   * replaces path params in the request url 
+   * @see https://pactumjs.github.io/#/request-making?id=path-params
    */
   withPathParams(key: string, value: any): Spec;
   withPathParams(params: object): Spec;
 
   /**
-   * adds query params to the request url - /comments?id=1&user=snow&sort=asc
-   * @example
-   * await pactum.spec()
-   *  .get('/api/users')
-   *  .withQueryParams('sort', 'asc')
-   *  .withQueryParams({ 'id': '1', 'user': 'snow' })
-   *  .expectStatus(200);
+   * adds query params to the request url - /comments?user=snow&sort=asc
+   * @see https://pactumjs.github.io/#/request-making?id=query-params
    */
   withQueryParams(key: string, value: any): Spec;
   withQueryParams(params: object): Spec;
 
   /**
-   * appends graphQL query to the request body
-   * @example
-   * await pactum.spec()
-   *  .post('http://www.graph.com/graphql')
-   *  .withGraphQLQuery(`{ hello }`)
-   *  .expectStatus(200);
+   * appends graphQL query to the request body or query params
+   * @see https://pactumjs.github.io/#/request-making?id=graphql
    */
   withGraphQLQuery(query: string): Spec;
 
   /**
    * appends graphQL variables to the request body
-   * @example
-   * await pactum.spec()
-   *  .post('http://www.graph.com/graphql')
-   *  .withGraphQLQuery(`
-   *    hero(episode: $episode) {
-   *      name
-   *    }`
-   *  )
-   *  .withGraphQLVariables({
-   *    "episode": "JEDI"
-   *  })
-   *  .expectStatus(200);
+   * @see https://pactumjs.github.io/#/request-making?id=graphql
    */
   withGraphQLVariables(variables: object): Spec;
 
-  /**
-   * attaches json object to the request body
-   * @example
-   * await pactum.spec()
-   *  .post('https://jsonplaceholder.typicode.com/posts')
-   *  .withJson({
-   *    title: 'foo',
-   *    body: 'bar',
-   *    userId: 1
-   *  })
-   *  .expectStatus(201);
-   */
-  withJson(json: object): Spec;
-  withJson(filePath: string): Spec;
-
   /**
    * attaches headers to the request
-   * @example
-   * await pactum.spec()
-   *  .get('/api/posts')
-   *  .withHeaders('Authorization', 'Basic xxx')
-   *  .withHeaders({
-   *    'content-type': 'application/json'
-   *  })
-   *  .expectStatus(201);
+   * @see https://pactumjs.github.io/#/request-making?id=headers
    */
   withHeaders(key: string, value: any): Spec;
   withHeaders(headers: object): Spec;
 
-    /**
+  /**
    * attaches cookies to the request
-   * @example
-   * await pactum.spec()
-   *  .get('/api/posts')
-   *  .withCookies('name', 'snow')
-   *  .withCookies({
-   *    name: 'snow',
-   *    httpOnly: null
-   *  })
-   *  .withCookies('name=snow')
-   *  .expectStatus(201);
+   * @see https://pactumjs.github.io/#/request-making?id=cookies
    */
   withCookies(key: string, value: any): Spec;
   withCookies(json: object): Spec;
@@ -270,83 +154,54 @@ declare class Spec {
 
   /**
    * attaches body to the request
-   * @example
-   * await pactum.spec()
-   *  .post('https://jsonplaceholder.typicode.com/posts')
-   *  .withBody(JSON.stringify({
-   *    title: 'foo',
-   *  }))
-   *  .expectStatus(201);
+   * @see https://pactumjs.github.io/#/request-making?id=body
    */
   withBody(body: any): Spec;
 
+  /**
+   * attaches json object to the request body
+   * @see https://pactumjs.github.io/#/request-making?id=body
+   */
+   withJson(json: object): Spec;
+   withJson(filePath: string): Spec;
+
   /**
    * appends file to the form-data
-   * @example
-   * await pactum.spec()
-   *  .post('url')
-   *  .withFile('./file/path')
-   * 
-   * await pactum.spec()
-   *  .post('url')
-   *  .withFile('key', './file/path', { contentType: 'text/plain' })
+   * @see https://pactumjs.github.io/#/request-making?id=file-uploads
    */
   withFile(path: string, options?: FormData.AppendOptions): Spec;
   withFile(key: string, path: string, options?: FormData.AppendOptions): Spec;
 
   /**
    * attaches form data to the request with header - "application/x-www-form-urlencoded"
-   * @example
-   * await pactum.spec()
-   *   .post('https://jsonplaceholder.typicode.com/posts')
-   *   .withForm({
-   *     'user': 'drake'
-   *   })
-   *   .expectStatus(200);
+   * @see https://pactumjs.github.io/#/request-making?id=form-data
    */
   withForm(form: any): Spec;
 
   /**
    * attaches multi part form data to the request with header - "multipart/form-data"
    * @see https://www.npmjs.com/package/form-data
-   * @example
-   * const form = new pactum.request.FormData();
-   * form.append('my_file', fs.readFileSync(path), { contentType: 'application/xml', filename: 'jUnit.xml' });
-   * await pactum.spec()
-   *  .post('https://jsonplaceholder.typicode.com/upload')
-   *  .withMultiPartFormData(form)
-   *  .expectStatus(200);
+   * @see https://pactumjs.github.io/#/request-making?id=form-data
    */
   withMultiPartFormData(form: FormData): Spec;
 
   /**
    * attaches multi part form data to the request with header - "multipart/form-data"
    * @see https://www.npmjs.com/package/form-data
-   * @example
-   *  await pactum.spec()
-   *   .post('https://jsonplaceholder.typicode.com/upload')
-   *   .withMultiPartFormData('file', fs.readFileSync(path), { contentType: 'application/xml', filename: 'jUnit.xml' })
-   *   .withMultiPartFormData('user', 'drake')
-   *   .expectStatus(200);
+   * @see https://pactumjs.github.io/#/request-making?id=form-data
    */
   withMultiPartFormData(key: string, value: string | Buffer | Array | ArrayBuffer, options?: FormData.AppendOptions): Spec;
 
   /**
    * with http core options
    * @see https://nodejs.org/api/http.html#http_http_request_url_options_callback
-   * 
-   * @example
-   * await pactum.spec().spec()
-   *  .get('some-url')
-   *  .withCore({
-   *    agent: myAgent
-   *  })
-   *  .expectStatus(200);
+   * @see https://pactumjs.github.io/#/request-making?id=core-options
    */
   withCore(options: RequestOptions): Spec;
 
   /**
    * basic auth
+   * @see https://pactumjs.github.io/#/request-making?id=authentication
    */
   withAuth(username: string, password: string): Spec;
 
@@ -354,300 +209,151 @@ declare class Spec {
 
   /**
    * retry request on specific conditions
-   * @example
-   * // retry once on failure
-   * await pactum.spec().get('/some/url').retry().expectStatus(200);
-   * // retry twice on failure
-   * await pactum.spec().get('/some/url').retry(2).expectStatus(200);
-   * // retry once on failure with custom delay of 2 seconds
-   * await pactum.spec().get('/some/url').retry(1, 2000).expectStatus(200);
-   * // retry with custom strategy
-   * await pactum.spec().get('/some/url')
-   *  .retry({
-   *     strategy: (req, res) => res.statusCode !== 200
-   *   })
-   *  .expectStatus(200);
+   * @see https://pactumjs.github.io/#/integration-testing?id=retry-mechanism
    */
   retry(count?: number, delay?: number): Spec;
   retry(options: RetryOptions): Spec;
 
   /**
    * overrides default log level for current spec
+   * @see https://pactumjs.github.io/#/api-settings?id=setloglevel
    */
   useLogLevel(level: LogLevel): Spec;
 
   /**
    * overrides default timeout for current request in ms
+   * @see https://pactumjs.github.io/#/request-making?id=request-timeout
    */
   withRequestTimeout(timeout: number): Spec;
 
   /**
    * runs specified custom expect handler
-   * @example
-   * handler.addExpectHandler('hasAddress', (req, res, data) => {
-   *   const json = res.json;
-   *   assert.strictEqual(json.type, data);
-   * });
-   * await pactum.spec()
-   *  .get('https://jsonplaceholder.typicode.com/users/1')
-   *  .expect('isUser')
-   *  .expect('hasAddress', 'home');
+   * @see https://pactumjs.github.io/#/response-validation?id=custom-validations
    */
   expect(handlerName: string, data?: any): Spec;
-
-  /**
-   * runs specified custom expect handler
-   * @example
-   * await pactum.spec()
-   *  .get('https://jsonplaceholder.typicode.com/users/1')
-   *  .expect('isUser')
-   *  .expect((req, res, data) => { -- assertion code -- });
-   */
   expect(handler: ExpectHandlerFunction): Spec;
 
   /**
    * expects a status code on the response
-   * @example
-   * await pactum.spec()
-   *  .delete('https://jsonplaceholder.typicode.com/posts/1')
-   *  .expectStatus(200);
+   * @see https://pactumjs.github.io/#/response-validation?id=status-amp-headers-amp-response-time
    */
   expectStatus(code: number): Spec;
 
   /**
    * expects a header on the response
-   * @example
-   * await pactum.spec()
-   *  .get('https://jsonplaceholder.typicode.com/posts/1')
-   *  .expectHeader('content-type', 'application/json; charset=utf-8')
-   *  .expectHeader('connection', /\w+/);
+   * @see https://pactumjs.github.io/#/response-validation?id=status-amp-headers-amp-response-time
    */
   expectHeader(header: string, value: any): Spec
 
   /**
    * expects a header in the response
-   * @example
-   * await pactum.spec()
-   *  .get('https://jsonplaceholder.typicode.com/comments')
-   *  .expectHeaderContains('content-type', 'application/json');
+   * @see https://pactumjs.github.io/#/response-validation?id=status-amp-headers-amp-response-time
    */
   expectHeaderContains(header: string, value: any): Spec
 
-  expectBody(body: any): Spec;
-
-  expectBodyContains(value: any): Spec;
-
-  /**
-   * expects a exact json object in the response
-   * @example
-   * await pactum.spec()
-   *  .get('https://jsonplaceholder.typicode.com/posts/1')
-   *  .expectJson({
-   *    userId: 1,
-   *    user: 'frank'
-   *  });
-   */
-  expectJson(json: object): Spec;
-
   /**
    * expects exact match on cookie in the response
-   * @example
-   * await pactum.spec()
-   *  .get('https://jsonplaceholder.typicode.com/posts/1')
-   *  .expectCookies('name', 'snow')
-   *  .expectCookies({
-   *    name: 'snow',
-   *    httpOnly: null
-   *  })
-   *  .expectCookies('name=snow')
-   *  .expectJson({
-   *    userId: 1,
-   *    user: 'frank'
-   *  });
-   */
-  expectCookies(key: string, value: any): Spec;
-  expectCookies(json: object): Spec;
-  expectCookies(raw: string): Spec;
+   * @see https://pactumjs.github.io/#/response-validation?id=expectcookies
+   */
+   expectCookies(key: string, value: any): Spec;
+   expectCookies(json: object): Spec;
+   expectCookies(raw: string): Spec;
 
-  /**
+   /**
    * expects a partial cookie in the response
-   * @example
-   * await pactum.spec()
-   *  .get('https://jsonplaceholder.typicode.com/posts/1')
-   *  .expectCookiesLike('name', 'snow')
-   *  .expectCookiesLike({
-   *    name: 'snow',
-   *    httpOnly: null
-   *  })
-   *  .expectCookiesLike('name=snow')
-   *  .expectJson({
-   *    userId: 1,
-   *    user: 'frank'
-   *  });
+   * @see https://pactumjs.github.io/#/response-validation?id=expectcookieslike
    */
   expectCookiesLike(key: string, value: any): Spec;
   expectCookiesLike(json: object): Spec;
   expectCookiesLike(raw: string): Spec;
 
   /**
-   * expects a partial json object in the response
-   * @example
-   * await pactum.spec()
-   *  .get('https://jsonplaceholder.typicode.com/comments')
-   *  .expectJsonLike([{
-   *    postId: 1,
-   *    id: 1,
-   *    name: /\w+/g
-   *  }]);
+   * performs strict equal on body text.
+   * @see https://pactumjs.github.io/#/response-validation?id=expectbody
    */
-  expectJsonLike(json: object): Spec;
+  expectBody(body: any): Spec;
 
   /**
-   * expects the response to match with json schema
-   * @see https://json-schema.org/learn/
-   * @example
-   * await pactum.spec()
-   *  .get('https://jsonplaceholder.typicode.com/posts/1')
-   *  .expectJsonSchema({
-   *    "properties": {
-   *      "userId": {
-   *        "type": "number"
-   *      }
-   *    },
-   *    "required": ["userId", "id"]
-   *  });
+   * performs strict equal on body text.
+   * @see https://pactumjs.github.io/#/response-validation?id=expectbodycontains
    */
-  expectJsonSchema(schema: object): Spec;
+  expectBodyContains(value: any): Spec;
 
   /**
-   * expects the json at path equals to the value
-   * @see https://www.npmjs.com/package/json-query
-   * @example
-   * await pactum.spec()
-   *  .get('some-url')
-   *  .expectJsonAt('[0].name', 'Matt')
-   *  .expectJsonAt('[*].name', ['Matt', 'Pet', 'Don']);
+   * expects a exact json object in the response
+   * @see https://pactumjs.github.io/#/response-validation?id=expectjson
    */
-  expectJsonAt(path: string, query: any): Spec;
+  expectJson(json: object): Spec;
+  expectJson(path: string, value: any): Spec;
 
   /**
-   * expects the json at path to be like the value (uses expectJsonLike internally)
-   * @see https://www.npmjs.com/package/json-query
-   * @example
-   * await pactum.spec()
-   *  .get('some-url')
-   *  .expectJsonLikeAt('[*].name', ['Matt', 'Pet', 'Don']);
+   * expects a partial json object in the response
+   * @see https://pactumjs.github.io/#/response-validation?id=expectjsonlike
    */
-  expectJsonLikeAt(path: string, value: any): Spec;
+  expectJsonLike(json: object): Spec;
+  expectJsonLike(path: string, value: any): Spec;
 
   /**
    * expects the response to match with json schema
-   * @see https://json-schema.org/learn/
-   * @example
-   * await pactum.spec()
-   *  .get('/api/users/1')
-   *  .expectJsonSchemaAt('user.address', {
-   *    "type": "object",
-   *    "properties": {
-   *      "city": {
-   *        "type": "string"
-   *      }
-   *    }
-   *  });
+   * @see https://pactumjs.github.io/#/response-validation?id=expectjsonschema
    */
-  expectJsonSchemaAt(path: string, schema: object): Spec;
+  expectJsonSchema(schema: object): Spec;
+  expectJsonSchema(path: string, schema: object): Spec;
 
   /**
    * expects the json to match with value
-   * @example
-   * const { like } = require('pactum-matchers');
-   * 
-   * await pactum.spec()
-   *  .get('/api/users')
-   *  .expectJsonMatch({
-   *    id: like(1),
-   *    name: 'jon'
-   *  });
+   * @see https://pactumjs.github.io/#/response-validation?id=expectjsonmatch
    */
   expectJsonMatch(value: object): Spec;
-
-  /**
-   * expects the json at path to match with value
-   * @see https://www.npmjs.com/package/json-query
-   * @example
-   * const { like } = require('pactum-matchers');
-   * 
-   * await pactum.spec()
-   *  .get('/api/users')
-   *  .expectJsonMatchAt('people[0]', {
-   *    id: like(1),
-   *    name: 'jon'
-   *  });
-   */
-  expectJsonMatchAt(path: string, value: object): Spec;
+  expectJsonMatch(path: string, value: object): Spec;
 
   /**
    * expects the json to strictly match with value
+   * @see https://pactumjs.github.io/#/response-validation?id=expectjsonmatch
    */
   expectJsonMatchStrict(value: object): Spec;
+  expectJsonMatchStrict(path: string, value: object): Spec;
 
   /**
-   * expects the json at path to strictly match with value
+   * expect network errors
+   * @see https://pactumjs.github.io/#/response-validation?id=expecterror
    */
-  expectJsonMatchStrictAt(value: object): Spec;
-
   expectError(): Spec;
   expectError(error: string): Spec;
   expectError(error: object): Spec;
 
   /**
    * expects the json to match with stored snapshots
-   * @example
-   * const { like } = require('pactum-matchers');
-   * 
-   * await pactum.spec()
-   *  .get('/api/users')
-   *  .expectJsonSnapshot({
-   *    id: like(1),
-   *    name: 'jon'
-   *  });
+   * @see https://pactumjs.github.io/#/response-validation?id=expectjsonsnapshot
    */
   expectJsonSnapshot(value?: object): Spec;
 
   /**
    * updates the reference snapshot file
+   * @see https://pactumjs.github.io/#/response-validation?id=expectjsonsnapshot
    */
   updateSnapshot(): Spec;
 
   /**
    * expects request completes within a specified duration (ms)
+   * @see https://pactumjs.github.io/#/response-validation?id=status-amp-headers-amp-response-time
    */
   expectResponseTime(value: number): Spec;
 
   /**
-   * stores spec request & response data 
+   * stores spec request & response data
+   * @see https://pactumjs.github.io/#/integration-testing?id=stores
    */
   stores(name: string, path: string): Spec;
-
-  /**
-   * stores spec request & response data 
-   */
   stores(name: string, handlerName: string): Spec;
 
   /**
    * returns custom response from json response using custom handler
+   * @see https://pactumjs.github.io/#/integration-testing?id=returns
    */
   returns(handlerName: string): Spec;
-
-  /**
-   * returns custom response from json response using json-query
-   */
   returns(path: string): Spec;
-
-  /**
-   * returns custom response from json response using custom function
-   */
-  returns(handler: ReturnHandlerFunction): Spec;
+  returns(handler: CaptureHandlerFunction): Spec;
 
   /**
    * records data that will be available in reports
@@ -656,12 +362,7 @@ declare class Spec {
 
   /**
    * waits after performing a request & before response validation
-   * @example
-   * await pactum.spec()
-   *  .useMockInteraction('some background operation')
-   *  .post('/url/)
-   *  .wait(1000)
-   *  .expectStatus(200)
+   * @see https://pactumjs.github.io/#/component-testing?id=non-crud-endpoints
    */
   wait(milliseconds: number): Spec;
   wait(spec: Spec): Spec;
@@ -673,24 +374,26 @@ declare class Spec {
 
   /**
    * executes the test case
+   * @see https://pactumjs.github.io/#/api-testing
    */
   toss(): Promise<T>;
 
   /**
    * returns chai like assertions
+   * @see https://pactumjs.github.io/#/api-testing?id=testing-style
    * @requires .toss() should be called beforehand.
    */
   response(): Expect;
 
   /**
-   * _should be used with pactum.e2e()_
-   * 
-   * returns new instance of cleanup spec
+   * cleanup spec for e2e testing
+   * @see https://pactumjs.github.io/#/e2e-testing
    */
   clean(name?: string, data?: any): Spec;
 
   /**
    * runs registered reporters
+   * @see https://pactumjs.github.io/#/api-reporter?id=reporting-for-bdd
    */
   end(): Spec;
 }
diff --git a/src/models/Spec.js b/src/models/Spec.js
index c6dddd9..8b60055 100644
--- a/src/models/Spec.js
+++ b/src/models/Spec.js
@@ -337,26 +337,6 @@ class Spec {
     return this;
   }
 
-  expectBody(body) {
-    this._expect.body = body;
-    return this;
-  }
-
-  expectBodyContains(value) {
-    this._expect.bodyContains.push(value);
-    return this;
-  }
-
-  expectJson(json) {
-    this._expect.json.push(json);
-    return this;
-  }
-
-  expectJsonLike(json) {
-    this._expect.jsonLike.push(json);
-    return this;
-  }
-
   expectCookies(key, value) {
     this._expect.cookies.push(utils.createCookieObject(key, value));
     return this;
@@ -367,45 +347,45 @@ class Spec {
     return this;
   }
 
-  expectJsonSchema(schema) {
-    this._expect.jsonSchema.push(schema);
-    return this;
-  }
-
-  expectJsonSchemaAt(path, value) {
-    this._expect.jsonSchemaQuery.push({ path, value });
+  expectBody(body) {
+    this._expect.body = body;
     return this;
   }
 
-  expectJsonAt(path, value) {
-    this._expect.jsonQuery.push({ path, value });
+  expectBodyContains(value) {
+    this._expect.bodyContains.push(value);
     return this;
   }
 
-  expectJsonLikeAt(path, value) {
-    this._expect.jsonQueryLike.push({ path, value });
+  expectJson(path, value) {
+    typeof value === 'undefined' ? this._expect.json.push(path) : this._expect.jsonQuery.push({ path, value });
     return this;
   }
+  expectJsonAt(...args) { return this.expectJson(...args); }
 
-  expectJsonMatch(value) {
-    this._expect.jsonMatch.push(value);
+  expectJsonLike(path, value) {
+    typeof value === 'undefined' ? this._expect.jsonLike.push(path) : this._expect.jsonQueryLike.push({ path, value });
     return this;
   }
+  expectJsonLikeAt(...args) { return this.expectJsonLike(...args); }
 
-  expectJsonMatchAt(path, value) {
-    this._expect.jsonMatchQuery.push({ path, value });
+  expectJsonSchema(path, value) {
+    typeof value === 'undefined' ? this._expect.jsonSchema.push(path) : this._expect.jsonSchemaQuery.push({ path, value });
     return this;
   }
+  expectJsonSchemaAt(...args) { return this.expectJsonSchema(...args); }
 
-  expectJsonMatchStrict(value) {
-    this._expect.jsonMatchStrict.push(value);
+  expectJsonMatch(path, value) {
+    typeof value === 'undefined' ? this._expect.jsonMatch.push(path) : this._expect.jsonMatchQuery.push({ path, value });
     return this;
   }
+  expectJsonMatchAt(...args) { return this.expectJsonMatch(...args); }
 
-  expectJsonMatchStrictAt(path, value) {
-    this._expect.jsonMatchStrictQuery.push({ path, value });
+  expectJsonMatchStrict(path, value) {
+    typeof value === 'undefined' ? this._expect.jsonMatchStrict.push(path) : this._expect.jsonMatchStrictQuery.push({ path, value });
     return this;
   }
+  expectJsonMatchStrictAt(...args) { return this.expectJsonMatchStrict(...args); }
 
   expectJsonSnapshot(matchers) {
     this._expect.jsonSnapshot.push(matchers);
diff --git a/src/models/server.js b/src/models/server.js
index b31dc9c..36631a6 100644
--- a/src/models/server.js
+++ b/src/models/server.js
@@ -207,9 +207,7 @@ function registerPactumRemoteRoutes(server) {
   app.all('/api/pactum/*', (req, res) => {
     switch (req.path) {
       case '/api/pactum/health':
-        res.writeHead(200, { "Content-Type": "text/plain" });
-        res.write("OK");
-        res.end();
+        handleRemoteHealth(res);
         break;
       case '/api/pactum/handlers':
         handleRemoteHandler(req, res, server);
@@ -220,15 +218,42 @@ function registerPactumRemoteRoutes(server) {
       case '/api/pactum/reporter/end':
         handlerRemoteReporterEnd(res);
         break;
+      case '/api/pactum/state':
+        handleRemoteState(req, res);
+        break;
       default:
-        res.writeHead(404, { "Content-Type": "text/plain" });
-        res.write("404 Not Found\n");
-        res.end();
+        handleRemoteDefault(res);
         break;
     }
   });
 }
 
+function handleRemoteHealth(res) {
+  res.writeHead(200, { "Content-Type": "text/plain" });
+  res.write("OK");
+  res.end();
+}
+
+function handleRemoteDefault(res) {
+  res.writeHead(404, { "Content-Type": "text/plain" });
+  res.write("404 Not Found\n");
+  res.end();
+}
+
+async function handleRemoteState(req, res) {
+  try {
+    for (let i = 0; i < req.body.length; i++) {
+      const { name, data } = req.body[i];
+      await hr.state(name, data);
+    }
+    handleRemoteHealth(res);
+  } catch (error) {
+    log.error(`Unable to run remote state handlers - ${error}`);
+    handleRemoteError(error, res);
+  }
+
+}
+
 function handleRemoteHandler(req, res, server) {
   try {
     const ids = [];
@@ -244,12 +269,16 @@ function handleRemoteHandler(req, res, server) {
     res.end();
   } catch (error) {
     log.error(`Error running handlers - ${error}`);
-    res.writeHead(400, { "Content-Type": "application/json" });
-    res.write(JSON.stringify({ error: error.message }));
-    res.end();
+    handleRemoteError(error, res);
   }
 }
 
+function handleRemoteError(error, res) {
+  res.writeHead(400, { "Content-Type": "application/json" });
+  res.write(JSON.stringify({ error: error.message }));
+  res.end();
+}
+
 function handleRemoteInteractions(req, res, server) {
   res = new ExpressResponse(res);
   const raws = [];


Test patch:
diff --git a/src/models/E2E.js b/src/models/E2E.js
index 6670b38..fde3f5c 100644
--- a/src/models/E2E.js
+++ b/src/models/E2E.js
@@ -2,7 +2,6 @@ const Step = require('./Step');
 const log = require('../plugins/logger');
 const helper = require('../helpers/helper');
 const rlc = require('../helpers/reporter.lifeCycle');
-const hr = require('../helpers/handler.runner');
 
 class E2E {
 
@@ -18,15 +17,6 @@ class E2E {
     this.steps = [];
   }
 
-  async init() {
-    try {
-      await hr.initialize();
-    } catch (error) {
-      log.error('Failed to initialize');
-      throw error;
-    }
-  }
-
   step(name) {
     reportStep(this.steps);
     const bail = this.steps.some(_step => _step.specs.some(spec => spec.status === 'FAILED'));
@@ -60,12 +50,6 @@ class E2E {
     if (errors.length > 0) {
       throw errors[0];
     }
-    try {
-      await hr.cleanup();
-    } catch (error) {
-      log.error('Failed to cleanup');
-      throw error;
-    }
   }
 
 }
diff --git a/test/component/bdd.spec.js b/test/component/bdd.spec.js
index 2905983..68049cf 100644
--- a/test/component/bdd.spec.js
+++ b/test/component/bdd.spec.js
@@ -66,8 +66,8 @@ describe('BDD', () => {
   it('should return a valid user', async () => {
     expect(response).to.have.json({ name: 'snow' });
     expect(response).should.have.jsonLike({ name: 'snow' });
-    expect(response).to.have.jsonAt('name', 'snow');
-    expect(response).to.have.jsonLikeAt('name', 'snow');
+    expect(response).to.have.json('name', 'snow');
+    expect(response).to.have.jsonLike('name', 'snow');
     expect(response).to.have.body({ name: 'snow' });
     spec.response().to.have.bodyContains(`snow`);
   });
@@ -77,7 +77,7 @@ describe('BDD', () => {
   });
 
   it('should return a valid schema at', async () => {
-    expect(response).to.have.jsonSchemaAt('.', { properties: { name: { type: 'string' } } });
+    expect(response).to.have.jsonSchema('.', { properties: { name: { type: 'string' } } });
   });
 
   it('should return a match', async () => {
@@ -85,7 +85,7 @@ describe('BDD', () => {
   });
 
   it('should return a match at', async () => {
-    expect(response).to.have.jsonMatchAt('.', like({ name: 'snow' }));
+    expect(response).to.have.jsonMatch('.', like({ name: 'snow' }));
   });
 
   it('should return a strict match', async () => {
@@ -93,7 +93,7 @@ describe('BDD', () => {
   });
 
   it('should return a strict match at', async () => {
-    expect(response).to.have.jsonMatchStrictAt('.', like({ name: 'snow' }));
+    expect(response).to.have.jsonMatchStrict('.', like({ name: 'snow' }));
   });
 
   it('should return a response within 500 ms', async () => {
diff --git a/test/component/default.spec.js b/test/component/default.spec.js
index d49ca43..c09c335 100644
--- a/test/component/default.spec.js
+++ b/test/component/default.spec.js
@@ -75,7 +75,7 @@ describe('Mock - Default Mock Interaction', () => {
     expect(mock.getInteraction('GET_FIRST_PROJECT').exercised).equals(true, 'interaction should be exercised');
     await pactum.spec()
       .get('http://localhost:9393/api/projects/1')
-      .expectStatus(200)
+      .expectStatus(200);
     expect(mock.getInteraction('GET_FIRST_PROJECT').callCount).equals(2, 'interaction should be called twice');
     expect(mock.getInteraction('GET_FIRST_PROJECT').exercised).equals(true, 'interaction should be exercised');
 
diff --git a/test/component/deprecated.spec.js b/test/component/deprecated.spec.js
new file mode 100644
index 0000000..f18b021
--- /dev/null
+++ b/test/component/deprecated.spec.js
@@ -0,0 +1,16 @@
+const pactum = require('../../src/index');
+
+describe('Deprecated', () => {
+
+  it('expects', async () => {
+    await pactum.spec()
+      .useInteraction('get people')
+      .get('http://localhost:9393/api/people')
+      .expectJsonAt('people[0].name', 'Matt')
+      .expectJsonLikeAt('people[0].name', 'Matt')
+      .expectJsonMatchAt('people[0].name', 'Matt')
+      .expectJsonMatchStrictAt('people[0].name', 'Matt')
+      .expectJsonSchemaAt('people[0].name', { type: 'string' });
+  });
+
+});
diff --git a/test/component/e2e.spec.js b/test/component/e2e.spec.js
index f08572a..f03699e 100644
--- a/test/component/e2e.spec.js
+++ b/test/component/e2e.spec.js
@@ -322,81 +322,6 @@ describe('E2E', () => {
 
   });
 
-  describe('E2E - With Initializers & Cleanups', () => {
-
-    before(async () => {
-      handler.addInitializeHandler('Authorize', () => { });
-      handler.addCleanupHandler('UnAuthorize', () => { });
-      this.e2e = pactum.e2e('E2E with Initializers & Cleanups');
-      await this.e2e.init();
-    });
-
-    it('save user', async () => {
-      await this.e2e
-        .step('Save User')
-        .spec('User.AddUser')
-        .clean('User.DeleteUser');
-    });
-
-    it('get user', async () => {
-      await this.e2e
-        .step('Get User')
-        .spec('User.GetUser');
-    });
-
-    it('clean up', async () => {
-      await this.e2e.cleanup();
-    });
-
-  });
-
-  describe('E2E - With Initializer Fails', () => {
-
-    before(async () => {
-      handler.addInitializeHandler('Authorize', () => { throw 'Failed'; });
-      handler.addCleanupHandler('UnAuthorize', () => { });
-      this.e2e = pactum.e2e('E2E with Initializers & Cleanups');
-    });
-
-    it('init failed', async () => {
-      let err;
-      try {
-        await this.e2e.init();
-      } catch (error) {
-        err = error;
-      }
-      expect(err).not.undefined;
-    });
-
-    it('clean up', async () => {
-      await this.e2e.cleanup();
-    });
-
-  });
-
-  describe('E2E - With Initializer Fails', () => {
-
-    before(async () => {
-      handler.addInitializeHandler('Authorize', () => { });
-      handler.addCleanupHandler('UnAuthorize', () => { throw 'Failed'; });
-      this.e2e = pactum.e2e('E2E with Initializers & Cleanups');
-    });
-
-    it('clean up failed', async () => {
-      let err;
-      try {
-        await this.e2e.cleanup();
-      } catch (error) {
-        err = error;
-      }
-      expect(err).not.undefined;
-    });
-
-  });
-
-  after(() => {
-    handler.addInitializeHandler('Authorize', () => { });
-    handler.addCleanupHandler('UnAuthorize', () => { });
-  });
+  after(() => {});
 
 });
\ No newline at end of file
diff --git a/test/component/expects.spec.js b/test/component/expects.spec.js
index 886f724..8eb1ad0 100644
--- a/test/component/expects.spec.js
+++ b/test/component/expects.spec.js
@@ -308,7 +308,7 @@ describe('Expects', () => {
           }
         })
         .get('http://localhost:9393/api/users/1')
-        .expectJsonSchemaAt('id', {
+        .expectJsonSchema('id', {
           "type": "string"
         });
     } catch (error) {
@@ -459,8 +459,8 @@ describe('Expects', () => {
       })
       .get('http://localhost:9393/api/users')
       .expectStatus(200)
-      .expectJsonAt('people[country=NZ].name', 'Matt')
-      .expectJsonAt('people[*].name', ['Matt', 'Pete', 'Mike']);
+      .expectJson('people[country=NZ].name', 'Matt')
+      .expectJson('people[*].name', ['Matt', 'Pete', 'Mike']);
   });
 
   it('json query - on root array', () => {
@@ -481,9 +481,9 @@ describe('Expects', () => {
       })
       .get('http://localhost:9393/api/users')
       .expectStatus(200)
-      .expectJsonAt('[1].country', 'AU')
-      .expectJsonAt('[country=NZ].name', 'Matt')
-      .expectJsonAt('[*].name', ['Matt', 'Pete', 'Mike']);
+      .expectJson('[1].country', 'AU')
+      .expectJson('[country=NZ].name', 'Matt')
+      .expectJson('[*].name', ['Matt', 'Pete', 'Mike']);
   });
 
   it('json query - on root object - fails', async () => {
@@ -508,8 +508,8 @@ describe('Expects', () => {
         })
         .get('http://localhost:9393/api/users')
         .expectStatus(200)
-        .expectJsonAt('people[country=NZ].name', 'Matt')
-        .expectJsonAt('people[*].name', ['Matt', 'Pete']);
+        .expectJson('people[country=NZ].name', 'Matt')
+        .expectJson('people[*].name', ['Matt', 'Pete']);
     } catch (error) {
       err = error;
     }
@@ -536,7 +536,7 @@ describe('Expects', () => {
       })
       .get('http://localhost:9393/api/users')
       .expectStatus(200)
-      .expectJsonLikeAt('people[*].name', ['Matt', 'Pete']);
+      .expectJsonLike('people[*].name', ['Matt', 'Pete']);
   });
 
   it('json query like - fails', async () => {
@@ -561,7 +561,7 @@ describe('Expects', () => {
         })
         .get('http://localhost:9393/api/users')
         .expectStatus(200)
-        .expectJsonLikeAt('people[*].name', ['Matt', 'Pet']);
+        .expectJsonLike('people[*].name', ['Matt', 'Pet']);
     } catch (error) {
       err = error;
     }
@@ -600,7 +600,7 @@ describe('Expects', () => {
       })
       .get('http://localhost:9393/api/users')
       .expectStatus(200)
-      .expectJsonMatchAt('people[*].name', eachLike('Matt'));
+      .expectJsonMatch('people[*].name', eachLike('Matt'));
   });
 
   it('json match at - fails', async () => {
@@ -625,7 +625,7 @@ describe('Expects', () => {
         })
         .get('http://localhost:9393/api/users')
         .expectStatus(200)
-        .expectJsonMatchAt('people[*].name', eachLike(12));
+        .expectJsonMatch('people[*].name', eachLike(12));
     } catch (error) {
       err = error;
     }
@@ -637,7 +637,7 @@ describe('Expects', () => {
       .useInteraction('get people')
       .get('http://localhost:9393/api/people')
       .expectStatus(200)
-      .expectJsonMatchStrictAt('people[*].name', eachLike('Matt'));
+      .expectJsonMatchStrict('people[*].name', eachLike('Matt'));
   });
 
   it('json match strict at - fails', async () => {
@@ -647,7 +647,7 @@ describe('Expects', () => {
         .useInteraction('get people')
         .get('http://localhost:9393/api/people')
         .expectStatus(200)
-        .expectJsonMatchStrictAt('people[*].name', eachLike(12));
+        .expectJsonMatchStrict('people[*].name', eachLike(12));
     } catch (error) {
       err = error;
     }
diff --git a/test/component/interactions.spec.js b/test/component/interactions.spec.js
index 1d23ee6..f7f42d6 100644
--- a/test/component/interactions.spec.js
+++ b/test/component/interactions.spec.js
@@ -38,10 +38,10 @@ describe('Mock', () => {
         },
         "required": ["name", "id"]
       })
-      .expectJsonSchemaAt('id', {
+      .expectJsonSchema('id', {
         "type": "number"
       })
-      .expectJsonAt('id', 1)
+      .expectJson('id', 1)
       .toss();
   });
 
@@ -263,7 +263,7 @@ describe('Mock', () => {
         },
         "required": ["name", "id"]
       })
-      .expectJsonAt('id', 1)
+      .expectJson('id', 1)
       .toss();
   });
 
@@ -306,7 +306,7 @@ describe('Mock', () => {
         },
         "required": ["name", "id"]
       })
-      .expectJsonAt('id', 1)
+      .expectJson('id', 1)
       .toss();
   });
 
diff --git a/test/component/remote.server.spec.js b/test/component/remote.server.spec.js
index ba89b21..c403514 100644
--- a/test/component/remote.server.spec.js
+++ b/test/component/remote.server.spec.js
@@ -1,8 +1,7 @@
 const config = require('../../src/config');
 const pactum = require('../../src/index');
 const { expect } = require('chai');
-const mock = pactum.mock;
-const handler = pactum.handler;
+const { mock, handler } = pactum;
 
 describe('Remote Server - use with spec', () => {
 
diff --git a/test/component/remote.spec.js b/test/component/remote.spec.js
index e21bcea..0a82107 100644
--- a/test/component/remote.spec.js
+++ b/test/component/remote.spec.js
@@ -2,6 +2,7 @@ const pactum = require('../../src/index');
 const mock = require('../../src/exports/mock');
 const helper = require('../../src/helpers/helper');
 const sandbox = require('sinon').createSandbox();
+const { handler } = pactum;
 
 describe('Remote- post single mock interaction', () => {
 
@@ -226,4 +227,53 @@ describe('Remote - Reporter', () => {
     pactum.reporter.get().length = 0;
   });
 
+});
+
+describe('Remote - State', () => {
+
+  before(() => {
+    handler.addStateHandler('abc', () => { });
+    handler.addStateHandler('fail', ({ data }) => { if (data) throw 'abc'; });
+  });
+
+  it('post empty data', async () => {
+    await pactum.spec()
+      .post('http://localhost:9393/api/pactum/state')
+      .expectStatus(200);
+  });
+
+  it('post with one invalid handler name should fail', async () => {
+    await pactum.spec()
+      .post('http://localhost:9393/api/pactum/state')
+      .withJson([
+        {
+          name: 'xyz'
+        }
+      ])
+      .expectStatus(400);
+  });
+
+  it('post with one handler name should pass', async () => {
+    await pactum.spec()
+      .post('http://localhost:9393/api/pactum/state')
+      .withJson([
+        {
+          name: 'abc'
+        }
+      ])
+      .expectStatus(200);
+  });
+
+  it('post with one handler name fails to run', async () => {
+    await pactum.spec()
+      .post('http://localhost:9393/api/pactum/state')
+      .withJson([
+        {
+          name: 'fail',
+          data: true
+        }
+      ])
+      .expectStatus(400);
+  });
+
 });
\ No newline at end of file