documentation
  • Introduction
    • Overview
      • Scandium Features & Concepts
  • Setting up your account
  • Create a test case
  • Supported Actions
  • File uploads
  • Assertions
  • Groups
  • Step settings
  • Variables
  • System Functions
  • Email Testing
  • Data-driven Testing
  • Test Suites
  • Results
    • Test results
    • Suite results
  • Why did my test fail?
  • API Testing
    • Getting Started
    • API Suites
    • Scheduling and Monitoring
  • Mobile Application Testing
    • Create a mobile project
    • Uploading Apps
      • Android
      • iOS
    • Testing mobile app
  • Common Testing Scenarios
  • Test Management
    • Tests and Folders
    • Tags
  • INTEGRATIONS
    • Continuous Integration (CI/CD)
    • Azure Devops
    • Bamboo CI
    • Bitbucket Pipelines
    • Circle CI
    • Github Actions
  • GitLab CI
  • Jenkins
  • Travis CI
Powered by GitBook
On this page
  • Create a basic API request
  • Adding assertions to API requests
  • Viewing API Response
  • Variables in requests
  • Dynamic values and functions in requests
  1. API Testing

Getting Started

Get started with Scandium's standalone API testing module

PreviousAPI TestingNextAPI Suites

Last updated 6 months ago

Create a basic API request

On the Scandium API runner interface, you are able to create a new API request. To create an API request, you need to select the method of the request and provide the API URL (endpoint).

Press the Send button to initiate the request or press the Save button to save the request.

You can change the name/title of the request before and after saving:

Enter the desired name for your test case and press the Save button.

Try an example request

Method Type: GET

Additional information on API requests

The Scandium API runner interface allows you to add additional information to your API requests where needed.

Query parameters: Can be added from the 'Params' tab

Authorization: Scandium supports multiple authorization types out of the box, including Bearer Token, Basic Auth, API Key, Digest Auth, Oauth 1.0

Headers: You can add several header key-values as required by your API

Body: Scandium supports multiple body types as payload for your request. This includes: form-data, x-www-form-urlencoded, JSON, XML, Text, HTML and GraphQL.

Adding assertions to API requests

When you make API requests, you want to validate that the request outcome meets your expectations. With Scandium API Runner, you can add assertions to your API tests. To add. these assertions, click on the 'Assertions' tab.

You can add assertions for the following:

  • Status code

  • Response header

  • Response body type

  • Response body content

  • Request duration

To add an assertion,

  1. Select the assertion type.

  2. Select a condition for the assertion.

  3. Input the value to be checked for.

You can also combine multiple assertions for one request.

Viewing API Response

After sending your API requests, you can see the response to your requests in the tab below the request area.

This tab shows you the status code, the duration of the request, the size of the response and the content of the response. You can view the body of the response in JSON, look at the headers and also inspect the Assertions Result tab for result of the assertions you added.

Variables in requests

Variables make it easy to reuse a value in multiple API tests. For example, imagine the APIs you are testing have the base url https://example.com/api. This part of the URL is common to all endpoints, such that a login endpoint would like https://example.com/api/login while a registration endpoint would like https://example.com/api/register.

Now imagine you want to test these APIs across different environments such as staging, test and production, where all these environments have different base URLs. Normally, you'd have to update all test cases with the specific environment URL each time you want to run your API test against such environment.

But if you create the base URL as a variable, you'd only have to make the change once.

How to create a variable

You can create a variable by clicking on the Variable submenu

From the modal that appears, you can then add the names and values for your variables. You can add as many variables as you need.

Click on the Save button to save your newly added variable.

Using a variable (How to make reference to a variable)

Once you have created a variable, it will be available for you to use within your tests. Variables can be used in the endpoint field, headers, parameters and body of the request.

To reference a variable, type {{ (two curly braces), this will bring up a suggestion of the list of variables available, you can then select one from the list.

Dynamic values and functions in requests

When sending an API request, there could often be situations where you need to send a randomized value to your endpoint. For example, when testing a registration endpoint, you want to have a different email address value sent every time the request is made so that your application doesn't give you a "email already exists" error. This could also apply to phone numbers, usernames etc.

Scandium makes it easy for you to achieve this dynamic data input. Similar to the variables in requests, dynamic functions also use the {{ }} notation.

You can use this dynamic values in your:

  • URL

  • Query parameter keys and values

  • Header keys and values

  • Body payload

  • Cookies keys and values

To use the dynamic value in an accepted field, type the {{ where the value is required

A suggestion popup opens up from which you can then click on the 'Dynamic Values' button. Clicking on the button above shows you a modal containing multiple available functions you can choose from.

Below are the functions you can choose from:

Email: To help you generate unique emails. Useful in cases where you need to test signup flows and you need a unique email each time the test runs. e.g itKRJ.lkdhuz1bql@testmail.getscandium.com

Num: To help you generate numbers of any length. e.g 19660200324

Range: To help generate a number within two boundaries. e.g 236

Alpha: To generate letters of the alphabet. You can specify the number of letters needed and even which character set you want the letters to come from. e.g itKRJ

Alphanum: Similar to alpha, but also includes numbers in the generated value. e.g JlU1ZZcr

Date: To generate date value in a desired format. e.g 15/09/2023

Time: Generate timestamp value (epoch time). e.g 1694463242839

Datetime: To generate datetime value e.g Mon Sep 11 2023 21:13:50 GMT+0100 (West Africa Standard Time)

Boolean: To generate one of true or false.

NB: In JSON payload, you should still insert the dynamic function inside quotes

API URL:

When the request is sent, the variable (denoted by {{base_url}}) will get replaced by its value which in this case is

https://api.edudream.fr/location/country
https://api.edudream.fr
An API request with sample response
Select assertion operator/condition
Enter assertion value to check for
Response body
Assertion result
Choose a variable from the suggestion
Variable plus other string
Type two opening curly braces
Put dynamic functions in quote