http

The integration lets QA and development teams perform service-level testing with popular tools, enhanced by the capabilities of the Ordino Engine. Key benefits

  • Direct access to ordino-engine features within external test suites (e.g., Cypress, Playwright) in hybrid mode, reducing the need for internal framework team support.

  • Flexible service class design for encapsulating business rules in complex, event-driven user journeys with minimal code with solid design practices

  • Built-in TypeScript/JavaScript support and inherit copilot agent support


Engine Import

In any service or test file, import the HTTP API from @ordino.ai/ordino-engine:

import { ordinoSuite } from '@ordino.ai/ordino-engine';

const http = ordinoSuite.api(ApiServiceType.HTTP);

Core HTTP Methods

Ordino provides a rich set of HTTP helper methods for building and executing API requests:

Method

Description

BaseUrl(url: string)

Set the base API URL.

setUrl(path: string)

Set the endpoint path.

setHeaders(obj)

Set request headers (local to request).

clearHeaders()

Clear locally set headers.

setGlobalHeader(key, value)

Set a header for all requests.

clearGlobalHeaders()

Remove all globally set headers.

setValue(key, value)

Store a variable in memory.

getValue(key)

Retrieve a stored variable.

requestGet()

Send a GET request.

requestPost(data)

Send a POST request with body data.

requestPut(data)

Send a PUT request with body data.

requestDelete()

Send a DELETE request.

requestGetWithQuery(query)

Send a GET request with query params.

Writing API Requests

GET Request

Example of sending a GET request with Ordino Engine in Cypress:

http.BaseUrl("https://api.example.com");
http.setUrl('/users/123');

http.requestGet().then((response) => {
  expect(response.status).to.eq(200);
  expect(response.body.id).to.eq('123');
});
  • BaseUrl() → Defines the API base URL.

  • setUrl() → Sets the endpoint path.

  • requestGet() → Executes a GET request.


POST Request

Example of sending a POST request with headers and payload:

http.BaseUrl("https://api.example.com");
http.setUrl('/users');
http.setHeaders({
  'Content-Type': 'application/json',
  'Authorization': `Bearer ${token}`
});

http.requestPost({ name: 'John Doe', email: 'john@example.com' })
  .then((response) => {
    expect(response.status).to.eq(201);
    http.setValue("userId", response.body.id); // store for later use
  });
  • setHeaders() → Adds request-specific headers.

  • requestPost(data) → Sends a POST request with the given payload.

  • setValue(key, value) → Stores values (e.g., IDs, tokens) for later requests.


PUT Request

Example of updating a resource using PUT:

const userId = http.getValue("userId");

http.BaseUrl("https://api.example.com");
http.setUrl(`/users/${userId}`);
http.setHeaders({
  'Content-Type': 'application/json'
});

http.requestPut({ name: 'John Updated' })
  .then((response) => {
    expect(response.status).to.eq(200);
  });
  • getValue() → Retrieves a stored variable (e.g., userId from a previous request).

  • requestPut(data) → Sends a PUT request with the specified payload.


DELETE Request

Example of deleting a resource using DELETE:

const userId = http.getValue("userId");

http.BaseUrl("https://api.example.com");
http.setUrl(`/users/${userId}`);

http.requestDelete()
  .then((response) => {
    expect(response.status).to.eq(204);
  });
  • requestDelete() → Executes a DELETE request.

  • Commonly used to clean up test data after execution.

Last updated